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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' s4 @$ ~* A+ f4 _1 _
  1. [code]EDMA sample test application
    - j4 p: Q/ I% U! ~
  2. /*
    # T* z& i1 A$ F9 G# `* U
  3. * edma_test.c
    ! F% j7 J: `; ~! z0 a- R& M
  4. *
    , q4 o3 ?4 U2 G
  5. * brief  EDMA3 Test Application
    ) Y  i5 m6 w8 `/ o$ W7 E) |
  6. *) h$ e4 ]) f: g. D
  7. *   This file contains EDMA3 Test code.: k7 c( v+ N7 h6 y" G  C
  8. *
    6 U+ k" d" w1 y  c) h7 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ I8 B% H. U0 \2 G* F8 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + d: @- v/ h0 R2 `
  11. *         TO CHANGE.
    & Q& Z' L' C# f" j$ d. m
  12. *) c9 H5 i; ]! E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( e; ^) F( x' Y
  14. *6 z8 n. M! D8 L
  15. * This program is free software; you can redistribute it and/or
    & e+ ]' o1 O" d& r* r- V0 g
  16. * modify it under the terms of the GNU General Public License as
    / r; a! @" f0 P: D! L2 O
  17. * published by the Free Software Foundation version 2.9 ^0 {$ @# s* E
  18. *: Z" p; w: ?; c& |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. R9 t* y8 t4 p3 @
  20. * kind, whether express or implied; without even the implied warranty
    4 p% x  n* P" s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. t( H$ C* K/ Y: Q0 W; I+ D. M8 |
  22. * GNU General Public License for more details.
    ! m" o0 g; M# D( u
  23. */
    , K. E# b/ y8 d# C2 ^
  24. * f7 M4 t9 h) B# `* }
  25. #include <linux/module.h>% _' r: J% s7 F" ]4 @8 X! Y
  26. #include <linux/init.h>
    9 l1 y/ B# X, r8 S+ i; \
  27. #include <linux/errno.h>
    ' F) Z; _/ m# Y
  28. #include <linux/types.h>8 b1 [- Y' m5 S! M. I0 u
  29. #include <linux/interrupt.h>( u0 n! ?2 v0 D7 O
  30. #include <asm/io.h>
    " i' s0 a. S* }6 g8 ]: M: {; F/ t7 H) O
  31. #include <linux/moduleparam.h>' L, C6 i2 U; P5 g3 X5 T1 g! {+ b
  32. #include <linux/sysctl.h>1 o0 T2 B8 k$ M
  33. #include <linux/mm.h>  c1 \; D& H- f
  34. #include <linux/dma-mapping.h>! G$ u2 |6 V9 j
  35. / c; L4 c( a; `2 l% ]; ?- C$ J4 E
  36. #include <mach/memory.h>' S$ C. }) p# {) G9 ]2 T8 A% ?
  37. #include <mach/hardware.h>
    ) _9 S8 |3 t0 y* W7 Q* u
  38. #include <mach/irqs.h>
    9 P' Q5 a" }# K: w3 G
  39. #include <asm/hardware/edma.h>2 H% k; S; I* r! u' d2 e

  40. 0 \5 p  n% B6 s! }( h  T
  41. #undef EDMA3_DEBUG
    ' V% S# O! L% ?$ S( Q
  42. /*#define EDMA3_DEBUG*/3 ]2 H: F- I  u1 J4 n/ W# F6 v
  43. 7 `/ U/ e+ r; C) B, ]. X- N9 ^
  44. #ifdef EDMA3_DEBUG% Z' q- L9 K0 I5 O! r( D( o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " \: _$ [( s! B+ u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; x+ z7 v8 |5 _7 X" ]% I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 z; y( q4 J9 G* f
  48. #else% }: C  v/ e& S( l5 F
  49. #define DMA_PRINTK( x... )
    # l" l# f4 c: b! I
  50. #define DMA_FN_IN
    / d/ O: Q& I( ?* k( v
  51. #define DMA_FN_OUT
    & ?* Y- O2 W, P. `1 N, T' c+ k0 G
  52. #endif7 M0 t. M% E' a4 I  j3 Q
  53. . u) E' R# ^) m5 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; @  v$ Z0 w0 d2 L
  55. #define STATIC_SHIFT                3
    5 r8 J$ J6 P! e4 |# f' f! G6 Z' W
  56. #define TCINTEN_SHIFT               20
    . {$ c: O! W1 m" [
  57. #define ITCINTEN_SHIFT              21
    ; {' w3 |% v: _3 {
  58. #define TCCHEN_SHIFT                22! G9 I1 a0 \1 V# ^
  59. #define ITCCHEN_SHIFT               23+ Q; ^* i, ]$ m$ _  ~

  60. + o; _2 O' t. g7 N0 m$ m
  61. static volatile int irqraised1 = 0;
      E' T% g, E* E/ T: x0 G
  62. static volatile int irqraised2 = 0;
    ! H+ o. q% U! {5 \$ W
  63. 3 M: y6 Q: k5 k4 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # G8 q1 x, G4 u. j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B& y0 @+ J6 N  P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 M2 q' |) I3 W; X" m9 R
  67. # ?7 R& S6 q! t6 X6 {0 G) l
  68. dma_addr_t dmaphyssrc1 = 0;4 O7 J5 w( M/ \3 n$ r
  69. dma_addr_t dmaphyssrc2 = 0;
    8 `2 g: L% D7 c! V9 O/ z
  70. dma_addr_t dmaphysdest1 = 0;
    0 v. {; [8 ], q: f9 `: r1 ?
  71. dma_addr_t dmaphysdest2 = 0;4 f; q, l# e7 b" X
  72. ; ]% F% Z+ @+ y  g% F
  73. char *dmabufsrc1 = NULL;
    0 K% N& H' d& q6 N
  74. char *dmabufsrc2 = NULL;
    # J' H% v5 b$ p, ^: t
  75. char *dmabufdest1 = NULL;
    9 _( ]; x  J4 l5 C
  76. char *dmabufdest2 = NULL;
    ( s4 }4 F, b6 u4 d% A
  77. 9 w6 `) z. v' x* v6 _
  78. static int acnt = 512;- e- T' H( I, B, V% ]0 i
  79. static int bcnt = 8;
    , w8 J2 S+ z* Z( U* u! O) E
  80. static int ccnt = 8;1 u3 Q9 e: `/ x& x# M; C
  81. * h  _& o5 }  O. J- j
  82. module_param(acnt, int, S_IRUGO);; @2 H6 B1 q) x( d
  83. module_param(bcnt, int, S_IRUGO);. P' a0 w1 d: f% G3 _: J: p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ q% a0 h/ H* G3 n! b% `  N
: f* s/ t3 e# y8 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 F! z% R* A# z# a( w, {! P4 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 f+ k4 I1 v4 D  m' c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- ~+ {, r! ^  ]( e

. Q* X2 b/ v% J3 N3 l
( f# K# D. z+ [5 T' L; @' F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 08:18 , Processed in 0.038538 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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