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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 G% W, O% {% X% e5 x2 f
  1. [code]EDMA sample test application
    + {$ T& m5 H1 }
  2. /*# d% v& p% S4 t3 P5 L6 M
  3. * edma_test.c! T" b) D% J" W6 g
  4. *1 U. s, t/ Q+ `+ {  d. Z% L1 G; c
  5. * brief  EDMA3 Test Application
    $ E$ G% r" n7 P' I
  6. *
    ( O1 d* r1 R% M; y6 d( T
  7. *   This file contains EDMA3 Test code.3 I  K3 Z+ l" |9 b8 q  P" j. w- l
  8. *
      \# D9 ?. e7 n" X- r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " o2 [& Y5 r3 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, A% F4 a) w, f: X7 L. E
  11. *         TO CHANGE.. N; k& b3 T* k+ n6 N+ }: ?
  12. *9 f! Z2 t& W" `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  u) M4 R% d( D( Y# v& Z0 Z
  14. *# q( l  y4 d/ }9 H
  15. * This program is free software; you can redistribute it and/or
    + d- m0 Q  X- S' C* l' n
  16. * modify it under the terms of the GNU General Public License as. |0 n! M- Q; r7 {1 O  s- y
  17. * published by the Free Software Foundation version 2., J1 E4 i1 J2 d
  18. *3 N2 j+ _3 e( Y2 a5 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( U# Q. ^2 i. a6 V
  20. * kind, whether express or implied; without even the implied warranty
    6 q% I; Z; M$ K. ]: a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# r" ]7 S3 r0 J0 L
  22. * GNU General Public License for more details.
    # z8 R- g: p# L6 o0 f
  23. */
    ) T3 R9 i4 I0 N

  24. ) `( s5 j! @* p0 g8 `
  25. #include <linux/module.h>
    5 V9 H# C' i3 a- f- A8 `0 X
  26. #include <linux/init.h>' S0 K' y0 _- c( z2 J7 [& E
  27. #include <linux/errno.h>1 O7 A6 g7 j* z. O6 p
  28. #include <linux/types.h>- I1 q6 N$ F& ]7 l- w: J
  29. #include <linux/interrupt.h>
    ' Q# @9 F% Q0 I
  30. #include <asm/io.h>/ {% T) d; ]. L2 \
  31. #include <linux/moduleparam.h>
    / l) a  v1 F: A
  32. #include <linux/sysctl.h>
    , i. A# _" t! W; O
  33. #include <linux/mm.h>
    ; A5 c5 }+ \! C: U% q
  34. #include <linux/dma-mapping.h>
    & M( Y% P$ [6 t/ G4 A% \
  35. ! H3 U* @! R1 Z) ]% N
  36. #include <mach/memory.h>
    5 l- T6 l% i. {1 S  Q* c6 ?% \
  37. #include <mach/hardware.h>
    1 z- |9 {, f# G: @, U+ Q
  38. #include <mach/irqs.h>% e# r8 p0 ~! O4 ?. \
  39. #include <asm/hardware/edma.h>5 H" Q  f% |% s8 e4 `2 g1 D

  40. " v' Z: H; d1 a8 U
  41. #undef EDMA3_DEBUG/ @+ a/ O- h7 ?
  42. /*#define EDMA3_DEBUG*/
    4 E1 i0 T0 o$ S$ J

  43. ; q$ n8 }  b- ]  Y; s* f, o
  44. #ifdef EDMA3_DEBUG6 T% _* K. j* O4 S8 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( U3 H5 h, L& Y' z; z' w# k* C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( g) s" Y5 o7 [  h6 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). M) x1 q( }5 t) x4 u; Z" `
  48. #else
    : F2 [6 e5 ]$ t3 \/ E; b' ~
  49. #define DMA_PRINTK( x... )# g; y! `$ h' \8 B2 Y1 t
  50. #define DMA_FN_IN
    & z) n( Y+ i: ~
  51. #define DMA_FN_OUT
    5 H7 V7 ~) J; f- l* t4 l# Z/ L
  52. #endif; x; e: D7 P1 q5 q* Y

  53. ' ]' }' w. Y' y" s- p2 A/ O8 h: I' z/ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 o& t/ N- l4 I( @- u
  55. #define STATIC_SHIFT                3
    5 C8 @4 f' }- G
  56. #define TCINTEN_SHIFT               20
      C. X7 b9 d: p6 e5 \
  57. #define ITCINTEN_SHIFT              21* l" T( M5 c% F3 W/ U
  58. #define TCCHEN_SHIFT                22. h6 e% Q& o* V& y
  59. #define ITCCHEN_SHIFT               23) s9 Z/ j0 m" B
  60. 2 Q5 {2 _: [: j. C' y# r2 T- J
  61. static volatile int irqraised1 = 0;
    ( p0 e1 N. L: |
  62. static volatile int irqraised2 = 0;& ^( u0 B$ r3 |* ^  ]4 J

  63. ; y5 Y6 ^9 P. }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r# U0 P5 A' c4 O( S" `2 J& F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " p. _5 M! o4 Z+ n) |% b, K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 F$ O% m  H! e. m) p; }

  67. 6 a) n7 _' A7 ~! X' _
  68. dma_addr_t dmaphyssrc1 = 0;5 ]$ j. o& U' c7 t" [; _$ R
  69. dma_addr_t dmaphyssrc2 = 0;
    , D1 C9 }, N  i6 g4 s5 H
  70. dma_addr_t dmaphysdest1 = 0;/ ]1 H. }/ x  a6 i
  71. dma_addr_t dmaphysdest2 = 0;
    % v0 ?% A- {. q* O
  72. ' B' K9 @! {2 f* w
  73. char *dmabufsrc1 = NULL;1 v. K2 a) `% l, K3 r$ V: g
  74. char *dmabufsrc2 = NULL;# {& w9 \$ G+ D/ L! T; ]
  75. char *dmabufdest1 = NULL;
    1 D7 K' n" k) H4 W2 L( v
  76. char *dmabufdest2 = NULL;8 H0 e5 b: s* r. Q
  77. # X0 R6 E4 h, |/ C: H' S* T; o* B
  78. static int acnt = 512;
    $ s9 p  Y9 y2 G1 f7 U2 R! A- C
  79. static int bcnt = 8;- e  I/ h. L3 q. v) E* X  M
  80. static int ccnt = 8;- l+ _1 k$ E8 [% G+ D/ P
  81. 8 T1 R3 Q+ ?) ^, F" q
  82. module_param(acnt, int, S_IRUGO);
    : q2 Q7 u/ |! t" h# Q+ E' x  ~* U
  83. module_param(bcnt, int, S_IRUGO);
    + p' ^5 X/ i* K# d" Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& ]1 n8 v+ [) B' b, W& h( y
  W' s5 n  F# p0 P  D& x5 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) c, \/ W) e5 \( P8 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 p" K, y; y, M9 p8 f( c3 M% ]; k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ n* I4 G$ o" S4 E: Q. r
- B, D& D0 n8 }" s+ j
( l( ?: u7 p5 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 15:35 , Processed in 0.038068 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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