OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13339|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, M! M: ]# A# e3 s4 ?
  1. [code]EDMA sample test application5 [, A( g: K5 e' A: j  c; a( K
  2. /*
    : y- K8 v1 {/ V5 l' x
  3. * edma_test.c& a0 C# v- H- W8 g2 T9 }. f0 Y% a
  4. *
    2 T2 z4 n. n" z
  5. * brief  EDMA3 Test Application
    / w* S  z5 b, U
  6. *
    ! `& @. l# c0 b3 h: N9 b3 ?
  7. *   This file contains EDMA3 Test code.
    ' k1 w; C  S8 Y" u- ~  A) O' P+ L
  8. *; ?: S! H8 ~7 u" b" X2 \' q, n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / S% k$ v6 f5 \$ y% J+ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " q8 s1 A2 N) z6 X" X. _
  11. *         TO CHANGE.
    3 u! F9 W# b3 H; @# L/ v
  12. *8 }( v5 s0 e: R" m0 H6 c$ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; t+ _: G" v4 l+ F! @- m
  14. *
    9 H- ]! o; C/ W
  15. * This program is free software; you can redistribute it and/or
    : Q& a: f7 ]$ m, @+ b
  16. * modify it under the terms of the GNU General Public License as$ d7 g, G1 k% j
  17. * published by the Free Software Foundation version 2.
    . A5 |/ v' M( m7 R0 \& y
  18. *
    - g+ W4 L) n3 V" ^) O+ Q: W4 h* [# n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ o4 b) f9 Y0 |. m% p
  20. * kind, whether express or implied; without even the implied warranty% A, L, e( I; v  h/ y! K  ]" f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 p" @/ d: H" T/ W$ ]: n2 e
  22. * GNU General Public License for more details.1 E/ M, D9 H' t" p( ]: Z9 |
  23. */
      i6 @  S6 r) ]) s" Q+ p. w

  24. ' K0 L+ m. B, b/ R- z
  25. #include <linux/module.h>: [8 f5 T6 M( s5 I" E. @
  26. #include <linux/init.h>
    ; `  L* ?9 |' V1 t
  27. #include <linux/errno.h>
    + z, j# s# E! k% o3 ^3 q$ }) P
  28. #include <linux/types.h>: B( H. R; x% S  N* ?
  29. #include <linux/interrupt.h>
    0 @6 S! z' ~! x* }
  30. #include <asm/io.h>
    ; o: y* @) \/ S/ g1 K
  31. #include <linux/moduleparam.h>4 |/ H8 b+ s# M" \2 j
  32. #include <linux/sysctl.h>4 @! O/ b, }  N$ t
  33. #include <linux/mm.h>
    1 ^9 Z: N" [6 w, Z. P
  34. #include <linux/dma-mapping.h>" U' ?* n$ y4 p

  35. 8 B, I2 v; e$ X( R5 f/ D5 p
  36. #include <mach/memory.h>
    - d# i9 u' W  ~7 [
  37. #include <mach/hardware.h>
    . q! I- @  p9 Z5 z5 E4 Y4 I
  38. #include <mach/irqs.h>- D0 H  [" S- w- a5 i( p; X  F9 ~
  39. #include <asm/hardware/edma.h>
    ; p* F- n4 [7 Z; X5 V; @; B

  40. 7 |+ E0 x: k& ?* b
  41. #undef EDMA3_DEBUG, s" v3 S/ u2 |# }9 u: z
  42. /*#define EDMA3_DEBUG*/- B. I- ~# H9 @6 K0 Y5 y
  43. + k  D3 G8 _5 Y- G, c3 Z  `3 O
  44. #ifdef EDMA3_DEBUG3 _) p# X- b6 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 E2 b3 `4 g" i3 [6 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): a4 E5 M6 Q/ A# M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! G. x$ u* T4 f
  48. #else
      E# Q) x/ g3 K( r$ X" ~
  49. #define DMA_PRINTK( x... )" Z: R$ w  X1 f, Z; f, S/ `
  50. #define DMA_FN_IN2 I4 X: q' F! J7 B  `: J
  51. #define DMA_FN_OUT' ~$ v4 m9 b7 z  ]% s( C0 U
  52. #endif
    2 @0 w. q1 T, j
  53. + w- ?$ i9 B5 k% v( S$ G" X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 u! R+ f. {+ k7 {# n, H9 {1 X1 z
  55. #define STATIC_SHIFT                3
    & Q* @. T; @3 t' k! ^+ x
  56. #define TCINTEN_SHIFT               20
    . ~; j8 Z; f1 X) _! I
  57. #define ITCINTEN_SHIFT              21& w  f; d& H* O! e/ n- u/ A
  58. #define TCCHEN_SHIFT                22
    6 ]5 g  q! k4 R0 |; f" t# o6 d6 G
  59. #define ITCCHEN_SHIFT               23
    ! q1 z' w. z# u, |
  60. # Z) A+ x6 S0 w( s. i* W# S
  61. static volatile int irqraised1 = 0;0 B1 C; h& {; ?
  62. static volatile int irqraised2 = 0;( P1 f9 v. z6 v" c

  63.   M( o. r$ v- U: N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 O; L5 C. `6 d8 i# G: ~8 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * s3 ~' {9 b* ~( n7 l* E% l- }! `4 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 q4 E7 y; R5 s- J" z8 C" g5 g$ o

  67. " c: X' ^9 o' |4 L8 T1 S
  68. dma_addr_t dmaphyssrc1 = 0;! I4 d$ Q6 I. m( s) Z  @1 e0 p
  69. dma_addr_t dmaphyssrc2 = 0;) C- e7 J( @* {3 u' N9 Y5 L
  70. dma_addr_t dmaphysdest1 = 0;
    0 Y8 a) r8 s8 P7 a
  71. dma_addr_t dmaphysdest2 = 0;
    . Q2 s% j! h* p5 t' z6 v
  72. 7 i, s) m! A0 o, K$ n9 m
  73. char *dmabufsrc1 = NULL;" p1 Y0 L, f+ T! Y. O- H4 Z
  74. char *dmabufsrc2 = NULL;
    * U" {* L+ @! H, g# U) A2 J
  75. char *dmabufdest1 = NULL;: ^9 g3 V* T( W6 m
  76. char *dmabufdest2 = NULL;
    ! J) }1 W. E: \# t

  77. ( g# B  ^. z% Y3 a
  78. static int acnt = 512;
    ! C  S8 E0 o; v' B: k
  79. static int bcnt = 8;2 C: a# n0 E: o, [8 A+ |8 d) a4 s
  80. static int ccnt = 8;6 G" k- Y5 m3 Q1 K

  81. : v9 c  C  ]+ @: N
  82. module_param(acnt, int, S_IRUGO);4 b( z  b! b% K1 c9 C
  83. module_param(bcnt, int, S_IRUGO);' Z  i; u4 b. c1 c3 r/ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' U: x7 A& ~: e+ w' z7 s, f+ F3 U* C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* n$ R! i1 k3 k
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 D* K$ J8 f0 u5 {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! v* D; I0 m, O/ I3 W7 a) {3 \
& C& ?& h4 d# D8 H; K, i; J
! t$ r& ^! \2 R& i* y& K5 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-4-9 01:35 , Processed in 0.039755 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表