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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 F: J' N* y' Q- N1 A2 V. r
  1. [code]EDMA sample test application. b. Z( N. m& a- J0 z) E+ X
  2. /*
    * O. O" G, ]( j' u$ M2 k% m2 ]3 l0 m
  3. * edma_test.c
    + P! _) |3 P# K9 V
  4. *6 A/ s8 k1 N! h  ?* W' [
  5. * brief  EDMA3 Test Application6 j- l8 R8 O3 G% i
  6. *
    " I4 H; W( K" g/ L$ d8 V! ~
  7. *   This file contains EDMA3 Test code.1 f) G! P; v4 p# B2 y3 B3 P- Z
  8. *
    2 B$ p7 O# ~: u! T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( d- e* Z% v5 n' X4 P7 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& f4 y- C" Y3 |4 Y6 q
  11. *         TO CHANGE.) z7 |  e" L. L( U8 r5 E
  12. *4 l5 B( ?! @" m# d! i6 |* @4 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 p. o- u, J& F
  14. *
    7 [, I8 j& f1 L3 q- |' _+ x
  15. * This program is free software; you can redistribute it and/or5 f! q- |6 E+ S
  16. * modify it under the terms of the GNU General Public License as+ v9 W# A) C0 @! Y$ H
  17. * published by the Free Software Foundation version 2.  b. z, d6 [$ L- b
  18. *' f: V. d2 f+ Q2 V: Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . p( M' q1 d& d
  20. * kind, whether express or implied; without even the implied warranty, `/ Q' G/ ?# [4 I+ P) i$ @. z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 t4 w5 \+ S( n& D: e1 ?( J
  22. * GNU General Public License for more details.
    $ s* A9 u; l* N' E5 W; B8 B
  23. */
    + N2 s8 W0 l' Z: h+ d4 B7 U
  24. ( _" k+ O3 `, J. {/ J
  25. #include <linux/module.h>
    , C. Z# U& a/ E9 f" ]
  26. #include <linux/init.h>
    3 o2 c  r0 F2 Y1 K7 K  m- k4 f3 C! S
  27. #include <linux/errno.h>
    1 |' T  k. F7 _4 p4 L7 {. `
  28. #include <linux/types.h>
    5 e' I& X4 |  F* x+ b& B: ^
  29. #include <linux/interrupt.h>% [* F. r' r, z2 U
  30. #include <asm/io.h>
    4 T) _) O1 ]& o) h% V. X9 ]
  31. #include <linux/moduleparam.h>" ^. D  M& U; p, W
  32. #include <linux/sysctl.h>' W% G$ V5 Z, ^' m, H8 ^4 S0 N
  33. #include <linux/mm.h>
    . Y) |* |. l6 R. ~/ C* D
  34. #include <linux/dma-mapping.h>
    ( q5 K1 K' l2 b

  35. - H+ `/ \7 Z) A3 s/ `
  36. #include <mach/memory.h>
    # L- k$ W& j7 e: K
  37. #include <mach/hardware.h>  Y$ R! G4 Q$ y2 r/ A( |
  38. #include <mach/irqs.h>- j- ]! r9 z6 e' m6 [
  39. #include <asm/hardware/edma.h>
    / h0 [& ]! E, x1 F

  40. 0 D, t  ~6 a: n+ S
  41. #undef EDMA3_DEBUG
    3 `% S% o5 n, ]4 E; c8 `
  42. /*#define EDMA3_DEBUG*/- @* N5 T* X+ o
  43. 2 V0 e: s$ m% i  ]+ q6 }% ?
  44. #ifdef EDMA3_DEBUG: }: _# Z, r3 O9 F3 U  y& E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ A6 k: S* t# x* b' C2 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; s  M0 K9 {* f5 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- \* W, F1 [: O% F6 T
  48. #else' O2 s- Z" I5 M7 i2 a/ J- w7 L
  49. #define DMA_PRINTK( x... )
    % _# q+ N0 x. B, K
  50. #define DMA_FN_IN
    8 n* O) c2 \7 i, N; e
  51. #define DMA_FN_OUT
    5 V. s  v' o( P' [4 w
  52. #endif" T/ l" J2 B& j! o/ i0 m4 ]

  53. " x6 P9 r) f! Q* D( G) p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 \" J4 X9 i& u  j
  55. #define STATIC_SHIFT                3# Q; b: m, q) k. |1 I2 u% _
  56. #define TCINTEN_SHIFT               20
    , ]# n4 ?2 ^4 G2 M) C- ]5 R
  57. #define ITCINTEN_SHIFT              21
    . }: v, {7 k7 Y, X
  58. #define TCCHEN_SHIFT                22
    + ~3 t3 a8 O5 \5 i3 @# T
  59. #define ITCCHEN_SHIFT               234 u1 S* Y# T+ i' I/ y& q
  60. ; t: s7 z' L. G; M1 h# {9 o/ d
  61. static volatile int irqraised1 = 0;
    / U, ?& X5 y4 {* y; f* L1 ]. G
  62. static volatile int irqraised2 = 0;1 L' y: h( G. B+ f" Z

  63. : ^- l7 L# y8 D$ n0 [$ w6 H! s% y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. s$ Z+ }8 a# M% h% ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . z# w! {6 B* ]8 W/ M- c" p7 f1 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L( W) c( E) F2 ?/ u  E

  67. , P) t" ~; m4 p4 x8 H( W7 g. P
  68. dma_addr_t dmaphyssrc1 = 0;7 P8 P9 l2 W" o+ `  ~  C
  69. dma_addr_t dmaphyssrc2 = 0;( H5 [* Z" X6 e- u1 @  `% d! B6 S  V
  70. dma_addr_t dmaphysdest1 = 0;
    ; Y5 Q# B4 x7 m8 `* v$ V
  71. dma_addr_t dmaphysdest2 = 0;: d8 F. w5 P0 H- ]7 X' R' Z

  72. & g; z0 K2 j; C4 t
  73. char *dmabufsrc1 = NULL;
    3 a) [+ N; ~$ E) _" `! b. l( z" a
  74. char *dmabufsrc2 = NULL;
    ; b! W5 a* {1 h, [$ d! R
  75. char *dmabufdest1 = NULL;
    # u1 h3 s' ]8 `, F# q! a
  76. char *dmabufdest2 = NULL;
    # `2 m! z. ~" `7 V

  77. # S' ^/ g% ~! z) @# W6 E& \9 d
  78. static int acnt = 512;
    0 I0 q- X4 y  r7 M/ P% o5 C
  79. static int bcnt = 8;
    6 b! k' S2 s7 ^8 S1 A# T
  80. static int ccnt = 8;
    : |" {' M+ S8 w0 ]
  81. 6 O' C. F; z& f' c  B/ v( y$ Z1 t
  82. module_param(acnt, int, S_IRUGO);* l6 l7 @8 N9 t: x5 U) G
  83. module_param(bcnt, int, S_IRUGO);
    . T1 n( D+ b4 J/ N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; v+ [' d! j% Q. a4 \
+ V2 }' N! b# |/ \& ^) L/ A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 q. s4 W, D/ Earm-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 K  q4 M* O. ]1 N& t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" D6 X$ v+ S7 Y8 x- n' v; _+ \0 p" _
! ^% l) d9 D% D: {$ b( {9 N1 E6 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-28 12:34 , Processed in 0.046673 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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