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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 L6 D: O; o8 G. A" J# g& q+ w. D
  1. [code]EDMA sample test application
    " F" B  H# f# j& |. D3 t
  2. /*8 c3 K7 ?# n+ f, r3 Z$ T' d: E! f0 g
  3. * edma_test.c; \8 H: Y9 U( D. t$ G( V! ]
  4. *
    ! s8 ^) d! m  [3 a8 T3 h
  5. * brief  EDMA3 Test Application3 \& I- m4 @2 ]2 Q) E7 ?
  6. *) @+ |" v& v# M( q! {
  7. *   This file contains EDMA3 Test code.2 q9 r1 t! t% \( L
  8. *
    % @2 F, B/ h, w% D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  c3 n% b# ~: ^" y+ t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ v! h8 x) J6 v& X3 u8 I+ n
  11. *         TO CHANGE.
    + p% X* K* ?- Y
  12. *
    ( z+ g4 ?  o0 d+ @) \' O3 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  @- R* R6 T( Y
  14. *
    6 O3 ]8 c3 n$ n" _6 @
  15. * This program is free software; you can redistribute it and/or
    , @  y; u7 X* |$ `( C
  16. * modify it under the terms of the GNU General Public License as
    " E$ P, n- n+ n# J) a6 G2 k0 r
  17. * published by the Free Software Foundation version 2.
    . ^8 i: h2 w6 s4 d
  18. *
    % L" Y9 _" R" [/ d9 ^+ j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. G/ m6 s1 {8 f4 H5 \, L& j
  20. * kind, whether express or implied; without even the implied warranty
    1 Y. ~% ?4 C& F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 q0 S: _& H4 e1 w, R6 c% e" a
  22. * GNU General Public License for more details.
    ( X# H+ F" Q7 t3 {
  23. */2 Y, ?0 W! U/ e0 U
  24. ; ?9 q: `9 ^' j/ N' s
  25. #include <linux/module.h>
    5 x8 g) e9 r  \. R
  26. #include <linux/init.h>* a  W4 F+ ~' r6 T4 \
  27. #include <linux/errno.h>
    ; _$ Q5 D/ B$ c# l  O+ w
  28. #include <linux/types.h>
    % b/ N2 n6 s+ [3 y/ V. N2 ]
  29. #include <linux/interrupt.h>) W4 t  k) v" _1 w# c
  30. #include <asm/io.h>( g4 B0 O' i$ k, [' _8 d) F2 J
  31. #include <linux/moduleparam.h>9 h2 M& {' C, P& z0 G' x, g" |- Z
  32. #include <linux/sysctl.h>* m: R3 k: b1 ]( X; u2 K; k
  33. #include <linux/mm.h>
    % O+ }' G$ x9 s3 a6 T- I0 _( `+ }
  34. #include <linux/dma-mapping.h>
    6 ]. }3 {5 v$ j

  35. " b/ X4 Y  J9 J/ j4 K
  36. #include <mach/memory.h>1 C. W+ v+ A0 t$ Y$ d7 O5 F5 n' K
  37. #include <mach/hardware.h>+ S7 T* d" I) [" N7 j8 b. e. U. `
  38. #include <mach/irqs.h>3 ]. }* g0 p: V2 J) ~$ g
  39. #include <asm/hardware/edma.h>. N; N8 R6 P$ T  Y7 o: d2 P$ T

  40. # n- h2 D0 G6 P" u' K0 [% D  i* N
  41. #undef EDMA3_DEBUG
    $ `; h% Y/ M# Q4 _& ~( {0 e3 w
  42. /*#define EDMA3_DEBUG*/
    # \" R5 h; O/ B7 Z

  43. + C0 I* c) u0 ?" e
  44. #ifdef EDMA3_DEBUG
    $ k" d, l8 p! m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 L9 X8 ^  r, p3 L4 e: `) V9 w8 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ B6 g1 x0 N2 c9 `; c# l0 y. o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l, _9 V- g% A8 I7 D% Y
  48. #else8 e' ?2 v" x$ ^* a3 M8 e
  49. #define DMA_PRINTK( x... )
    % J: J# ]1 {+ Q% ?
  50. #define DMA_FN_IN6 d. j1 g  ~& ]5 m
  51. #define DMA_FN_OUT& B9 _" V6 X# m
  52. #endif6 C& Y* q& K8 o# j' r5 }

  53. ' Y4 n4 ]' _1 w+ f4 f/ Y7 ]3 w7 U$ g, z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : Y; Z/ S7 }- U) s* }# G. P, [
  55. #define STATIC_SHIFT                3
    ) g) l6 B8 K" [$ R) b9 I9 ]
  56. #define TCINTEN_SHIFT               20: c) y$ s% c2 I  H
  57. #define ITCINTEN_SHIFT              21- J9 L/ v' ?6 M1 A' w) i
  58. #define TCCHEN_SHIFT                22
    6 y6 s, T: q+ C
  59. #define ITCCHEN_SHIFT               23# H/ O4 n% C- u9 B
  60.   T5 Y6 _6 Q) r' ^, O
  61. static volatile int irqraised1 = 0;
    % E( a; Q1 @/ x* [
  62. static volatile int irqraised2 = 0;3 J( _5 b7 K6 l  l2 m, _1 {3 E: P

  63. 1 f$ e9 R& {4 ]! t+ G% c$ ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " O& ~0 N6 Z+ E  l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _4 U" ^% h; `8 H" E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( P; Y4 i4 x- E; n$ ?% c* O. c; c

  67.   t* I* p0 T" C0 O: z( ^2 N
  68. dma_addr_t dmaphyssrc1 = 0;
    2 h$ ^- Y1 T7 h8 ~, |2 ?
  69. dma_addr_t dmaphyssrc2 = 0;( a( Z' E4 o+ |6 U: b9 b& V1 I
  70. dma_addr_t dmaphysdest1 = 0;
    ! \" A: y* Q- x$ l( S! `( I
  71. dma_addr_t dmaphysdest2 = 0;6 L# Q* D, I, F6 Q

  72. . l) m& A' [* R: R  x) _1 x7 F% q
  73. char *dmabufsrc1 = NULL;3 }2 p- d% \# U. Z' I
  74. char *dmabufsrc2 = NULL;. F) s4 S. T  Y! J( p$ y
  75. char *dmabufdest1 = NULL;. r/ B0 \- ^/ |: v
  76. char *dmabufdest2 = NULL;
    - e1 U6 ?# G/ [1 A4 N
  77. : M; F3 l0 ~5 G' Z( s1 U# M& a
  78. static int acnt = 512;6 G( u: P5 i$ @5 G4 ?0 d8 D, M' s
  79. static int bcnt = 8;2 }0 i6 J. K& G2 ?% w
  80. static int ccnt = 8;( t/ r) x/ U$ L" I9 f
  81. 4 ?( y6 V: w& l' a# o
  82. module_param(acnt, int, S_IRUGO);
    6 q+ k/ k) b0 {( |; `0 s. X- K
  83. module_param(bcnt, int, S_IRUGO);
    ) u0 _1 z* e  D2 Q/ ~) j/ q) x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ F4 V& z- }5 O$ b6 g* J

% r* S+ P6 _# W  X/ Z* [+ \9 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ K; n' e5 }7 D. c' X6 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 \/ @: Z7 ]* [9 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' V1 y5 T  U: Z) @
. s& ^+ {' ]" y9 u% {7 P7 M7 b+ @) P" {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 15:23 , Processed in 0.039724 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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