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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 @7 f8 V: H- H8 e
  1. [code]EDMA sample test application; W7 W; ~$ p  M! K, d- ~
  2. /*" w: s4 @! u: W( q) N' Z& ^+ _
  3. * edma_test.c/ \& j' s/ N; C6 F0 S. c
  4. *, t. `+ o) o' O  ~* g- y+ a( w
  5. * brief  EDMA3 Test Application; m( s1 ^4 d8 A+ G
  6. *
    + v4 {  ^1 C0 F) n# {  E
  7. *   This file contains EDMA3 Test code.
    : r! r9 F: Z6 z8 U: f$ F& [* p" J; \
  8. *3 q. w% c' X( j, O* y' z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 A! A7 E- m" J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' f. n* V4 E: c* E
  11. *         TO CHANGE.
    3 e( U* I6 @* d' ~4 y% a8 S
  12. *$ Y3 @/ Q" P, I1 M+ R" a% R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( d2 T% G4 A4 U% L, K
  14. *, m% c, C2 Y: s. \& `
  15. * This program is free software; you can redistribute it and/or
    5 M9 K8 m3 s) A/ l  O
  16. * modify it under the terms of the GNU General Public License as# j! e3 X# N1 W8 k7 v& ^
  17. * published by the Free Software Foundation version 2.( E7 v$ \' l' ~& {- y
  18. *! ~+ ^9 C4 w8 W' n. G6 A- x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% {) ~( e0 o, [1 \. J
  20. * kind, whether express or implied; without even the implied warranty' e* `4 K. L8 C: U2 C& A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ _4 v% e6 ^; T& y) ~
  22. * GNU General Public License for more details.
    " [! m% f5 B1 k) a( X+ K0 M
  23. */
    $ T( [- p: k3 u4 E4 e

  24. , z- w, k% y5 f
  25. #include <linux/module.h>! S, e! {2 g& g8 Q4 C4 }
  26. #include <linux/init.h>$ ]: Q( U, ^& W  w
  27. #include <linux/errno.h>
    ! A8 G! k8 ^: G0 J  m
  28. #include <linux/types.h>$ ~; C" j" n+ }$ {+ w
  29. #include <linux/interrupt.h>" M9 Y' i5 g2 c/ c9 v6 J3 t
  30. #include <asm/io.h>/ y3 E+ i0 q6 z% E0 T
  31. #include <linux/moduleparam.h>2 y+ I$ O7 k, n. q( }( [5 A
  32. #include <linux/sysctl.h>
    ! k0 K: ^% |  R$ K5 E' k
  33. #include <linux/mm.h>: W7 o4 q9 D, f$ v- c  y
  34. #include <linux/dma-mapping.h>
    ) L% p" d% ]; i2 k' E4 A; K4 K

  35. 3 p* C7 d/ ]) U' I
  36. #include <mach/memory.h>
    : f8 u2 D9 @  a/ c, h) d* z
  37. #include <mach/hardware.h>
    9 Y1 G  F- @+ `; d, ^( j
  38. #include <mach/irqs.h>
    ; g1 s5 l& @' ]6 H, c
  39. #include <asm/hardware/edma.h>5 w; M# I& \- a" B  N
  40. 5 T$ ~* r7 I. {! X! V3 e. _6 y
  41. #undef EDMA3_DEBUG
    ' P4 \% L; C7 w- J6 e& V$ G
  42. /*#define EDMA3_DEBUG*/( _4 ?. [+ N5 X

  43. 9 ~& |0 X! K" Y( L3 P
  44. #ifdef EDMA3_DEBUG6 i8 l4 w$ c" U' z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 |4 M8 h1 V# Y+ \# }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), n. u; }: x( H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% |6 k% ~+ S7 R( U
  48. #else4 ?- L# F- t# z% U; ~$ b2 x
  49. #define DMA_PRINTK( x... )
    . [/ I7 \* F: D# i1 O! i
  50. #define DMA_FN_IN/ S7 q/ ], k  W; z+ c# o9 y7 ^
  51. #define DMA_FN_OUT
    ) {9 R2 {; ]0 ?6 O% g7 T! Z0 b
  52. #endif
    , j9 {+ O5 j# B: p) w0 }( ]5 a
  53. 7 t4 c' ~  Y6 Z7 c* y+ F( d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' m+ w: T* I9 t: H$ d; k+ ]
  55. #define STATIC_SHIFT                3. m- J3 z; o1 I$ ^
  56. #define TCINTEN_SHIFT               200 |9 e2 m1 r, p3 @! H- {1 z
  57. #define ITCINTEN_SHIFT              21
    ; B1 D. X$ H; ?
  58. #define TCCHEN_SHIFT                22  X% E( y. m" i; X
  59. #define ITCCHEN_SHIFT               23  H1 f6 t8 E& v- u3 O) z% Y7 |
  60. & c: n9 p& n3 m) o
  61. static volatile int irqraised1 = 0;
    3 Y! Q$ O0 ]  I( k0 U
  62. static volatile int irqraised2 = 0;+ `$ R: ?6 R+ n: ^: g
  63. 8 g& ~, E+ M% V! V  h& N, W5 `7 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U+ }2 ]) r4 C$ ]% ]( T. O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / n( `6 S8 V: I$ t( O- b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 X1 W1 E; V$ i7 s
  67. 2 t. F& ~* g% y. J
  68. dma_addr_t dmaphyssrc1 = 0;
    2 @, D: @3 S' l, t# L# F
  69. dma_addr_t dmaphyssrc2 = 0;
    5 ~6 Y( P# g- _# a( P4 B! K
  70. dma_addr_t dmaphysdest1 = 0;5 j4 G* p6 p7 C3 j( V6 G5 V. [0 p6 [
  71. dma_addr_t dmaphysdest2 = 0;
    ; x, l2 r4 C5 q( |% ~

  72. 4 t; X5 |( ^$ E4 r* I% h& e$ z7 H% ]
  73. char *dmabufsrc1 = NULL;2 `8 I' W6 O; H9 V1 t) w1 P4 x
  74. char *dmabufsrc2 = NULL;* O$ E, [5 W; P9 H+ q
  75. char *dmabufdest1 = NULL;& d8 W1 j0 t1 W; r) I0 ^# A* \. a  \
  76. char *dmabufdest2 = NULL;* E2 j. k$ d$ o; N1 C1 j

  77. - l9 C5 Y1 x& T5 Q, @+ B
  78. static int acnt = 512;1 A$ `8 B: H, b6 \
  79. static int bcnt = 8;9 G. f8 c5 x$ c4 e0 F
  80. static int ccnt = 8;* o- m" K0 h- _
  81. $ q4 F" H4 F6 q2 S8 u
  82. module_param(acnt, int, S_IRUGO);
    2 i3 n7 r% \" i3 c9 M; x, ?
  83. module_param(bcnt, int, S_IRUGO);" }! R, z* V$ b! w% T6 j& u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( g2 ]8 X0 @; A% ~* v& D7 {& x; P
. b8 L$ s0 K8 a7 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# U* _( h$ \% y- I7 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ q/ |! B( \* N6 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! }. r9 J% t( m8 N! U1 k4 M

1 z0 @2 k. N0 J. b: T) S* D( D9 F3 \/ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 15:24 , Processed in 0.040475 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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