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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u+ \. h) {6 h, z9 q
  1. [code]EDMA sample test application8 B- x( J- t+ P! O) |
  2. /*$ `" m" ^7 q# k" Y1 `
  3. * edma_test.c
    $ T1 Q8 W: @$ p9 ~& o7 A* R6 [
  4. *
    ! r* b+ ?0 ?+ r# _8 P( q
  5. * brief  EDMA3 Test Application
    : E* L- G* Y: R: l. I/ [* }
  6. *
      G5 H0 @/ w7 b: d( k3 q9 E
  7. *   This file contains EDMA3 Test code.
    3 u9 r- |# R5 a" `
  8. *
    2 Y' G6 A* x9 R- K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* e0 N0 d: Z! F" [$ w8 @' b+ o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 Y$ x' Z/ P- l) s+ T
  11. *         TO CHANGE.
    4 S) I& c5 q( u7 o# l: g3 D" P# L$ @+ f
  12. *+ B. w6 W  K/ U& C1 |; R- }7 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u1 Q9 \$ Z4 r
  14. *; k4 z0 Y# e* u; a% t' r7 Z
  15. * This program is free software; you can redistribute it and/or. Z# Y" ]+ T! Y( `' h% T
  16. * modify it under the terms of the GNU General Public License as0 s% N4 ^, \; F  k( ~, l0 C
  17. * published by the Free Software Foundation version 2.
    ! ?% h& u0 u" Z8 b
  18. *
    3 e: p& E7 q- l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ O8 S" z5 l( o; H* A2 A6 T& O1 ~5 U
  20. * kind, whether express or implied; without even the implied warranty
    / B0 l" N+ X, Y8 J6 K  L! o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 Z' j* O; ]8 L
  22. * GNU General Public License for more details.4 t  @9 R" @& t* t
  23. */
      u+ I6 ^+ |" u7 U
  24. - A" a3 l! D& m9 [- j+ P; a. l
  25. #include <linux/module.h>
    # F  ^, E" n/ I' E# g) d
  26. #include <linux/init.h>
    * _4 b. y. @0 g4 W: G4 R
  27. #include <linux/errno.h>- q  S# h( ?" F. Y% X$ \
  28. #include <linux/types.h>
    / Q$ k( z7 V1 c; ~
  29. #include <linux/interrupt.h>
    . n' D  F( b( C' `! ]9 v
  30. #include <asm/io.h>
    : ^! _! X6 H5 O% m+ p
  31. #include <linux/moduleparam.h>
    4 {' G$ B0 t2 ]  V0 W; Z5 }. E
  32. #include <linux/sysctl.h>6 D: D1 V! Y1 {+ [: s
  33. #include <linux/mm.h>+ `+ X9 h2 B) l* e/ Z& t3 U
  34. #include <linux/dma-mapping.h>: m, T5 x( _* r3 P
  35. ; w- t( O& Q3 E7 v* g* L' f! b7 F2 u& {
  36. #include <mach/memory.h>* K# X$ q. a* i
  37. #include <mach/hardware.h>
    ( \+ Y) Q9 E, l9 {, F: I
  38. #include <mach/irqs.h>
    * ?( Y: u7 \# P
  39. #include <asm/hardware/edma.h>
    % y+ I; i2 _. [+ a

  40. 0 B- P4 x8 ^8 J1 Z9 _7 U
  41. #undef EDMA3_DEBUG: U3 M5 J. A/ ]" f4 O; X8 L
  42. /*#define EDMA3_DEBUG*/
    * K2 d+ X# \0 g* m4 N, @# V" O

  43. 3 ]9 i+ v& d* Q7 ~
  44. #ifdef EDMA3_DEBUG
    ) J# Y  |0 b! U  J+ i9 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* {9 i% M2 G4 Y$ Y& n0 Y( U) s# l/ q0 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  S5 W* y1 c9 k" M& B6 ]8 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# |& O  j* u( B
  48. #else4 p0 f: h7 _' z- |2 ~- ]" A! x+ p5 I
  49. #define DMA_PRINTK( x... )
    ( D3 e1 i+ Q" @4 N$ W/ V$ i: b, g* s
  50. #define DMA_FN_IN7 T2 f. m1 r3 Y& a* g) Y
  51. #define DMA_FN_OUT
    6 J! @4 ^5 I6 h6 V4 Q9 t' Z9 S% ~
  52. #endif
    $ @' B  ^/ ~- b8 S! c
  53. , Q& D1 {$ @9 e' V9 R1 e! x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ V' s3 u1 ~- [3 |/ l1 Y0 e
  55. #define STATIC_SHIFT                3
    ' W; }7 r1 v( o" V9 w
  56. #define TCINTEN_SHIFT               20  _. X1 ]. J) ~* A7 ~6 i- q  K
  57. #define ITCINTEN_SHIFT              21
    - U" o) X1 _) u
  58. #define TCCHEN_SHIFT                22# E8 U5 y0 |4 M; E6 T% P
  59. #define ITCCHEN_SHIFT               23
    3 _7 b* x) G& T" f* {; O; o

  60. 2 w: s- Y* Z( n4 R  y! K8 C
  61. static volatile int irqraised1 = 0;
    % g8 S9 v9 O/ `& |# Q: p, J6 a
  62. static volatile int irqraised2 = 0;
    ' Y" q5 P2 I% O" n) a
  63. 5 W, c* ?. \" ?0 ?7 r1 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]: ~, N) V" M( E9 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " u+ c  s( N6 p; Z# i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! q: R/ N* _  Q5 q5 J- |& v
  67. ( t- d" n# \! e; f# L8 V
  68. dma_addr_t dmaphyssrc1 = 0;
    1 }5 M/ ]; y7 U3 {0 ^# R
  69. dma_addr_t dmaphyssrc2 = 0;8 c2 W  [% ?1 j& |
  70. dma_addr_t dmaphysdest1 = 0;/ ^: ~) Y" _1 r" b
  71. dma_addr_t dmaphysdest2 = 0;
    8 I3 H4 d8 R2 g
  72. , I& X) ~' ^8 o8 r4 A
  73. char *dmabufsrc1 = NULL;  o5 X6 S% d8 }$ V# f
  74. char *dmabufsrc2 = NULL;
    . W! U. X) H% X0 w
  75. char *dmabufdest1 = NULL;
    + x% c; m- Q; w% F  X: A! y
  76. char *dmabufdest2 = NULL;
    2 h' w% |$ p( Z6 ~: P+ T: j, I

  77. % q$ z$ D8 ]& a. H+ q
  78. static int acnt = 512;* s, d' Q# v0 |& M. g
  79. static int bcnt = 8;
    ( f* U& s3 |7 N. P, `: b6 R& i, T8 z
  80. static int ccnt = 8;# X' V) p& j3 S3 D8 F

  81. 5 Z! Z! K* ]& H( x  q5 _9 w, |, O
  82. module_param(acnt, int, S_IRUGO);0 `) t& P. `; F5 q( W
  83. module_param(bcnt, int, S_IRUGO);& B' J+ i4 ~: m( b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 D5 Z$ ]1 {/ B9 ~4 n# P) c$ g9 D- s& a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 V+ l4 j3 ?7 O- q" s# qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 v8 T6 E) _# S2 Z* c, y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( o2 x+ K8 @* L0 R4 m- K( R; I# Q
' y2 {1 G- z0 P+ M) w# D* ^
3 I' I$ @; N3 R- X! K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 15:09 , Processed in 0.038571 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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