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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 H( @8 s$ z1 O4 x
  1. [code]EDMA sample test application
    " B4 E3 ^6 K% M$ x
  2. /*5 G  @: u( t6 ~8 R4 t
  3. * edma_test.c
    7 m. R5 f8 ]4 e+ _. S: ^
  4. *$ w2 r5 }$ h) A% D. b: Q
  5. * brief  EDMA3 Test Application  w, ^+ }5 q. p; a" p# M! P
  6. *3 ?0 t0 U( O: f! K1 W
  7. *   This file contains EDMA3 Test code.
    1 \" n" t6 P# p' F# j% X4 ]
  8. *' X5 K* z& u/ M* V1 o. G6 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & d3 ]6 K% b( x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + u- |0 r# o( e% h; b
  11. *         TO CHANGE.4 T1 }& m& y" q. m# a
  12. *
    * D- U. o8 w  N: ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; R0 E: I( Y4 j: ?
  14. *
    * m) c  a1 U7 T3 W% Z
  15. * This program is free software; you can redistribute it and/or
    % O- ~6 d" m0 Q  s
  16. * modify it under the terms of the GNU General Public License as4 a. `' S  @+ K) c5 p
  17. * published by the Free Software Foundation version 2.
    $ ^0 {7 l) Z$ q. B
  18. *6 i( a& q0 M* r3 W: N) c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Y4 a" N' \3 \# u
  20. * kind, whether express or implied; without even the implied warranty
    3 d6 u3 ?* Y4 e% D" [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: S% e2 Q/ w, `; d5 ?0 a
  22. * GNU General Public License for more details.
    ) c6 ~: A- P2 {- C* P7 o
  23. */6 t, f% `8 \; N
  24. 1 O/ o0 B$ [: C5 z
  25. #include <linux/module.h>
    ) k+ K( `1 c) t
  26. #include <linux/init.h>
    1 a4 L9 D# G. C: E/ r; T
  27. #include <linux/errno.h>5 |/ C! {2 Y$ c
  28. #include <linux/types.h>
    9 g( `' r- M$ c8 K' d6 W' h
  29. #include <linux/interrupt.h>
    2 R% F6 t' ^4 A0 x5 ^) K  G
  30. #include <asm/io.h>! F# G8 Z4 r5 `+ K0 m+ G
  31. #include <linux/moduleparam.h>
    / W+ O# D, ]8 V7 |
  32. #include <linux/sysctl.h>
    * [  w: L% ^6 w- o. C
  33. #include <linux/mm.h>  L, R% {/ r$ X9 \2 E
  34. #include <linux/dma-mapping.h>0 r" N  w5 x" p- J! v
  35. 3 g& O& ]7 P5 w$ H% X$ {
  36. #include <mach/memory.h>* T4 T1 @: S: |/ F- N" J9 G
  37. #include <mach/hardware.h>5 E' j8 b3 h' {' x6 S0 n* T. c" R
  38. #include <mach/irqs.h>; c. k5 D/ z9 k0 C
  39. #include <asm/hardware/edma.h>
    # M' w# E( R! d; }

  40. 6 T  I& r9 b7 K! F6 j
  41. #undef EDMA3_DEBUG: q/ }' u- H4 _4 C' ]
  42. /*#define EDMA3_DEBUG*/0 c( g4 B6 x6 o, x3 @
  43. # u! r0 E+ M1 s- p2 c
  44. #ifdef EDMA3_DEBUG
    * c& {# ?. R$ f: o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 g& e: J3 ?% o, W7 i4 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 O6 t3 W  o5 E4 S: O( H& v- R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' ]8 P/ {% w: ]. Q7 i
  48. #else7 P3 t5 H6 u4 ^5 q0 e/ e9 o
  49. #define DMA_PRINTK( x... )8 O$ f1 N- V' q6 n# @' ~( F
  50. #define DMA_FN_IN
    ) f( A2 q5 |  [- l- a1 q: w
  51. #define DMA_FN_OUT' E( M; y! v4 Q; q/ \7 x6 K$ p
  52. #endif; t; j: x8 e3 s$ J0 D
  53. ( `6 h0 v5 Z" i4 a! A3 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 ^/ r9 p4 ?. t. r0 k' b1 O7 R
  55. #define STATIC_SHIFT                37 A, U! g5 n5 T3 V0 l4 Z4 K
  56. #define TCINTEN_SHIFT               20( i4 A) ~9 Z/ k* I; N% B
  57. #define ITCINTEN_SHIFT              210 M/ |. S/ a: Q6 i
  58. #define TCCHEN_SHIFT                22
    7 R% l9 _. s8 a7 X
  59. #define ITCCHEN_SHIFT               231 _' z9 z+ i1 ]; z6 r  J; L% a
  60. $ B4 N) }' [$ h% R, ?; L& R
  61. static volatile int irqraised1 = 0;
    / P. ?% J; l5 r* `9 c9 ^5 E& L
  62. static volatile int irqraised2 = 0;0 q4 W0 h" D8 o! ~  q) i8 G* U
  63. ; K5 [3 y. K- w6 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! U! v, a$ `: C2 n% D/ T6 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' H, N- ?/ M. X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u; W6 Y+ Z, B5 x- d8 e
  67. 5 X7 p7 a  @( l4 }; k% e5 S$ A
  68. dma_addr_t dmaphyssrc1 = 0;8 e. o' Q' `* }8 L
  69. dma_addr_t dmaphyssrc2 = 0;' {, N+ L1 s; \* e. B* X4 `
  70. dma_addr_t dmaphysdest1 = 0;
    " m7 A3 \! ~% l, x3 L
  71. dma_addr_t dmaphysdest2 = 0;( y1 P0 s! J0 G' U5 M, K0 `

  72. # M, ?2 I9 W$ ?! Z, V
  73. char *dmabufsrc1 = NULL;8 P5 D- l# S# y0 p5 n) Z
  74. char *dmabufsrc2 = NULL;, e$ {% S+ L5 A' G' X) M. h
  75. char *dmabufdest1 = NULL;1 S9 ^" g3 a6 e, u
  76. char *dmabufdest2 = NULL;
    , ^  w# D; `2 z- H1 A' Q; B* Q

  77. & l% k" v. n9 e4 }
  78. static int acnt = 512;
    3 c# B6 e- N9 b7 \. u' v2 r
  79. static int bcnt = 8;$ @; m! g. f! R7 g' ^
  80. static int ccnt = 8;
    9 ~1 v8 H0 u* i) W+ \0 b, J0 d2 ]

  81. . ]% X; w: i  O. W; r7 `
  82. module_param(acnt, int, S_IRUGO);
    0 s6 P/ O1 N# a5 P. ?
  83. module_param(bcnt, int, S_IRUGO);
    % C+ V9 u" W* u% \0 r2 \6 H! T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- q4 J5 P8 i3 f. V. B6 J. r) O
) F$ n" L3 W' q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! D. b! o& d5 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 k1 n7 ^, W$ c3 \1 n2 U" w6 O9 X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 ]7 a8 [3 \1 C3 V" Q
: s7 H+ L. h/ M! c
; {% D: o  e8 [* n# \+ G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 06:14 , Processed in 0.038600 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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