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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- T; |# Y) ^. Q1 n9 G8 Z
  1. [code]EDMA sample test application
    ; j( ~$ e) v4 f, a" q& j+ U* f
  2. /*
    1 V, j6 r# s( F( T3 m2 F, [) }
  3. * edma_test.c% h2 z' }$ ~# m
  4. *
    ' D9 t; K( X% k2 f: j
  5. * brief  EDMA3 Test Application' M. [. x; i! d4 n% n
  6. *
    ; H& {* ]& o2 y
  7. *   This file contains EDMA3 Test code.8 z9 @, j& R- o- P. m
  8. *0 H; e6 u* H6 G% ^' R3 h" P% L3 D" N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) e7 V4 j7 }, y8 s/ Z& ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( s: H; p1 o1 `; w
  11. *         TO CHANGE.7 U7 d7 |4 e5 l* x$ g- }, ]: Z, e
  12. *
    : ~+ e5 R  x$ e+ B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, w8 |1 W2 t  K) e1 |
  14. *
    0 @1 _# D% u( H! Z; [
  15. * This program is free software; you can redistribute it and/or2 u4 R+ P7 r7 }5 E$ k, L1 |: \
  16. * modify it under the terms of the GNU General Public License as
    ( O: S$ U3 K$ t
  17. * published by the Free Software Foundation version 2.
    5 t8 @" ~- w) D/ ?$ v% k) p4 \, V* N
  18. *
    5 `  u9 {, ^4 b. n9 R+ |9 k$ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) U! o; q. C6 C* q' ~
  20. * kind, whether express or implied; without even the implied warranty& D- M/ B- x- A- O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: D( o* u6 j' c2 d/ n  n* @
  22. * GNU General Public License for more details.6 [2 f; Q: o6 t! Z- `
  23. */
    5 [( C: |- @0 j# N" C
  24. ' c: \, E: R) |3 z
  25. #include <linux/module.h>
    ' M2 l1 b" s' h
  26. #include <linux/init.h>
    3 y8 M* e1 r' H. Y
  27. #include <linux/errno.h>5 R- B& x$ I* i9 c
  28. #include <linux/types.h>  S- d+ z$ `/ a5 _% K  N
  29. #include <linux/interrupt.h>, @, ~- \* a3 V3 T9 d, D% z
  30. #include <asm/io.h>
    8 _, q9 [1 e: a2 |+ `' B6 W5 W
  31. #include <linux/moduleparam.h>7 l9 d3 s  {/ J9 I$ I+ Q8 X1 J
  32. #include <linux/sysctl.h>
    ( u5 Y! w7 J8 `
  33. #include <linux/mm.h>
    , Y0 ^: x4 h9 S& ^: |
  34. #include <linux/dma-mapping.h>
    5 w/ s! t& u0 T# G' [% F6 F
  35. 1 e' [7 U; ]. I
  36. #include <mach/memory.h>$ H" Y8 c# o- \% D/ ?; x- W
  37. #include <mach/hardware.h>( j3 I8 Y9 j9 L9 ~' E' ^- ?3 |
  38. #include <mach/irqs.h>7 d* t% Y2 o9 {$ Y$ t- i. m: P
  39. #include <asm/hardware/edma.h>
    2 c* T7 p$ G. M! Y7 j: z" z3 {
  40. . c9 P) a" s! f+ |9 \+ P$ Y
  41. #undef EDMA3_DEBUG' v# z; s6 r$ c, J# q8 K
  42. /*#define EDMA3_DEBUG*/
    9 d# i" {: Q$ t0 p
  43. , S0 v! o, r9 F0 }0 ^3 ?$ A* q
  44. #ifdef EDMA3_DEBUG
    . K5 `* ~4 C1 A" x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / y$ @0 x1 t' e  K1 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 i8 J0 s  y$ t1 x( S' a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Y: `, V& X0 N' a2 ?
  48. #else0 F$ b# o; F! d: y
  49. #define DMA_PRINTK( x... )
    / ~3 p" T4 k  d* G/ n3 i
  50. #define DMA_FN_IN
    ( v% A8 G( \  a; j2 D( |
  51. #define DMA_FN_OUT
    . a8 t% `0 d2 u! [9 E2 o
  52. #endif
    9 ?4 q6 i% [' U8 r& ?* W% z" P

  53. ! P, t2 f# M! q7 F6 i2 `/ [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 W( X2 P. C- w1 S  _. p& o
  55. #define STATIC_SHIFT                3
    # m2 b' n% l1 O+ [& f
  56. #define TCINTEN_SHIFT               20
    2 H8 S  f  u8 w& W
  57. #define ITCINTEN_SHIFT              21
    + Z% ?3 O( F" F
  58. #define TCCHEN_SHIFT                22
    : Q7 R3 b- x. t: p
  59. #define ITCCHEN_SHIFT               23
    6 z/ a4 k1 V! K; T" t6 _. @' k
  60. $ R( R- z, J( ]8 ^
  61. static volatile int irqraised1 = 0;
    2 Y2 B4 X( q( @: E! h
  62. static volatile int irqraised2 = 0;
    ) K2 A$ n' @* ]# i) v
  63. 1 {: n7 T4 O  a0 r) K7 Q- J$ W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `2 H7 Q. @2 O( c0 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # d; r2 ?0 \* Z! n) i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x# U9 g7 h, N& ~5 z1 n8 a* l
  67. / p2 p/ e) H# H7 i/ ^1 U. l9 B
  68. dma_addr_t dmaphyssrc1 = 0;
    ' z/ q  X) F7 Z. }) ?
  69. dma_addr_t dmaphyssrc2 = 0;
    + m! E" g. q. G+ t. Q* j* }
  70. dma_addr_t dmaphysdest1 = 0;7 g( x' Z9 d+ ^$ \- a
  71. dma_addr_t dmaphysdest2 = 0;/ K. i2 d# G" a/ ^( r
  72. 7 c# i4 `; [  Q3 _: w, |) O
  73. char *dmabufsrc1 = NULL;- Y  J  |4 V- t- [9 Y1 {- i
  74. char *dmabufsrc2 = NULL;- e, W6 [! K# O0 `/ C& u) P
  75. char *dmabufdest1 = NULL;3 k8 y! ^# n" G$ R% z* H
  76. char *dmabufdest2 = NULL;7 R5 b) j( n' f1 X+ V% a7 T; M; }
  77. # {' A, m9 n4 D
  78. static int acnt = 512;
    , |, M5 C- ^& g& u4 e$ V
  79. static int bcnt = 8;
    , r9 q, y; L2 p3 k/ N/ p% M" q
  80. static int ccnt = 8;
    5 l. ?7 ?4 k% C. F- V+ L" t1 R& D

  81. 2 d( S+ R2 I8 z5 {5 i) y4 C
  82. module_param(acnt, int, S_IRUGO);
    * J* ]' l+ e( T$ l6 S) P" [
  83. module_param(bcnt, int, S_IRUGO);5 t* w0 g# F1 ]8 B/ j+ O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* F! o; G6 ?( G) A5 c- V8 {: n+ b
" i  g* ^7 O. g7 r; G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 Y9 C+ y% O0 g0 S" O( farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& v. h/ n: X( g: ?$ H# M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 g( w; h4 y- T$ F& ~4 L! h* Z- @! Z6 p
' X! p- R9 P) Z

4 T/ D, w: R6 ?7 A  [/ J/ C4 A$ G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 00:27 , Processed in 0.039100 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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