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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 |% b4 a' g3 \$ m/ n3 u
  1. [code]EDMA sample test application* @2 R# x5 O" K' H
  2. /*" b; w+ B( X. k# V+ \2 e( T
  3. * edma_test.c3 o4 `0 ?$ {' D
  4. *. h1 Q! b+ u- ]; S
  5. * brief  EDMA3 Test Application
    - |1 e0 w& u2 T9 ?; N
  6. *8 o( K. b! u( k2 U0 F+ g
  7. *   This file contains EDMA3 Test code.) s  ~: d" J+ Z+ ~
  8. *- m& B! z( m2 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! x+ `! W2 P* r  L' ?9 X- m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , I+ a1 j2 ?* R/ h9 k9 X
  11. *         TO CHANGE.7 k& E/ h" a7 q, a. W+ f; Y
  12. ** ~  B$ g8 R& l( n9 t* n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Y, I' ~  E2 v) T5 V
  14. *! y5 k+ Q, R9 P3 X
  15. * This program is free software; you can redistribute it and/or
      R( K. p2 i/ {7 V8 V! f8 e6 `
  16. * modify it under the terms of the GNU General Public License as8 B: ^& W5 n0 o/ U
  17. * published by the Free Software Foundation version 2.
    * O6 j% u8 E; l5 M" X0 g
  18. ** c5 q# g+ p% \/ e/ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 B2 V' D8 F' }0 V
  20. * kind, whether express or implied; without even the implied warranty
    ' Z; ]- T$ [& t1 o* P! [$ l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 G: o6 I! I  p  w
  22. * GNU General Public License for more details.
    # |- z- N7 [2 I* v
  23. */
    - J) \: _$ j% g) i# c& e
  24. 5 l2 O1 S- U; q9 t. n8 |4 v
  25. #include <linux/module.h>1 h: ]7 M5 B- x1 \
  26. #include <linux/init.h>1 _4 i) C, s9 R) y, }7 p7 \3 C
  27. #include <linux/errno.h>! D3 a5 |; v4 B) ^  j2 v; q. l5 Y
  28. #include <linux/types.h>( Q- S" }+ F: V8 w. g
  29. #include <linux/interrupt.h>
    : L" v% d4 g% d" @8 v9 L9 z# M# b0 k
  30. #include <asm/io.h>3 N. p1 j* L" |( K; l
  31. #include <linux/moduleparam.h>0 _& l; L+ t, |: x5 g7 n* O# f
  32. #include <linux/sysctl.h>
    4 e5 F1 r- U3 ?. e
  33. #include <linux/mm.h>
    " F+ ?+ z) F+ c. |6 O! ~, T4 v
  34. #include <linux/dma-mapping.h>+ _8 D% O3 t# J6 S  i

  35. 9 n# j1 x. Z! ^! H) E
  36. #include <mach/memory.h>
    ! X2 U7 Q; [5 M5 I0 i0 ~  p
  37. #include <mach/hardware.h>) V3 Y2 R: k0 H& w
  38. #include <mach/irqs.h>
    9 B( m1 p5 x" {5 ?& q% s
  39. #include <asm/hardware/edma.h>+ s+ R8 `$ t2 u1 M7 P( R% R

  40. % z5 b3 ?6 a( R, c7 J4 M/ u
  41. #undef EDMA3_DEBUG
    5 A1 q# g1 r3 M9 N& d
  42. /*#define EDMA3_DEBUG*/) c* T$ g1 }. _) C+ L* o# ~' F$ h
  43. 3 d* z+ l, d3 o0 l- E
  44. #ifdef EDMA3_DEBUG3 _8 E4 S( a7 n& |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); P6 k; Q- m. S$ f0 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 I6 m6 r# h- Y* g% ^( ^3 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" B! E+ A5 A/ G2 T
  48. #else
    ' f5 q% k( e+ W: L
  49. #define DMA_PRINTK( x... )
    $ V  c+ x4 s8 d! z8 u
  50. #define DMA_FN_IN
      \- c4 z, Q: c! c: n
  51. #define DMA_FN_OUT
      N% I4 k* k4 x# s
  52. #endif" J2 C9 V7 F) F4 B' o4 T& ^4 {3 l+ H
  53.   w' R$ e: {* s7 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      l" J8 {8 R% u: g
  55. #define STATIC_SHIFT                3
    : k' N0 I7 j% j4 n# B2 D7 H
  56. #define TCINTEN_SHIFT               20. R4 t9 Y' A/ g* d
  57. #define ITCINTEN_SHIFT              21
    * h: \! m' f3 }
  58. #define TCCHEN_SHIFT                225 t2 B; Z2 m  J" b1 m. I7 Y/ M) k, P
  59. #define ITCCHEN_SHIFT               23
    4 S9 E* x5 q# N5 {: B$ p% L
  60. 0 c4 ?1 k$ L# t- m) P0 H3 T/ X
  61. static volatile int irqraised1 = 0;7 ]( H  Z* m; p/ j) X
  62. static volatile int irqraised2 = 0;
    - K3 `2 f- f- Q* {

  63. 7 b* y2 P) V6 s  D9 S4 A  C1 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M# p8 u( p' g% p% T  M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  w% q+ l: h! z& r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + C  a7 K3 a* o9 I

  67. : a8 J- ?& O% j7 n9 g( L7 a
  68. dma_addr_t dmaphyssrc1 = 0;! z! r" Y/ K/ p8 ?4 K3 _) o2 k
  69. dma_addr_t dmaphyssrc2 = 0;
    ' r6 c/ _5 f8 g/ k, f; H9 b
  70. dma_addr_t dmaphysdest1 = 0;# n9 a: C; q" B1 K* Y& E# C
  71. dma_addr_t dmaphysdest2 = 0;: @% W; J9 @2 M0 \
  72.   n3 ]4 C6 I! k, V) f8 D8 Y( Z# X
  73. char *dmabufsrc1 = NULL;! X6 u5 C+ b& Z+ ]- {
  74. char *dmabufsrc2 = NULL;& L; n6 {- X7 T* T3 h+ H
  75. char *dmabufdest1 = NULL;
    7 L  p) S* |, ], J  J
  76. char *dmabufdest2 = NULL;" i3 T" M# M9 U$ K1 o  j

  77. . N6 P" K  _' O& q* T1 C
  78. static int acnt = 512;6 m4 T" D: K. N) y- p. K% p
  79. static int bcnt = 8;
    ( r+ P8 w# J! o5 [( ^; ]/ h2 w; h
  80. static int ccnt = 8;
    ' g% Y9 ?# Y3 g) g2 V" q7 R; H. \
  81. ! }1 R4 s* O7 J+ d/ N- g* \$ ^+ H
  82. module_param(acnt, int, S_IRUGO);
    , b$ h9 C' n0 p$ @6 o9 @
  83. module_param(bcnt, int, S_IRUGO);
    $ u# r/ F, ^& _3 z  c4 L9 U4 I1 H' R& J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! T  Q4 a4 G+ P+ }/ L) ]9 y7 S  J8 P& K! X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 S/ G9 D1 A9 |* X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: D, h% f2 s9 `# B, L+ {3 P! q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 W/ G6 r' Q# z/ Q) v2 a, s2 W! |; _) B; N

- P0 \' _3 ]  j# K% k" S% R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 16:07 , Processed in 0.043175 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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