OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ S) C  L* F' j. X6 M4 M
  1. [code]EDMA sample test application
    , e/ B2 R9 X3 T1 I
  2. /*( D. ~( c* f5 N' M1 k3 F& j
  3. * edma_test.c, H& K4 n! F; L0 p) u  b
  4. *3 g5 A1 u0 k: A; t" |1 `( ^! M) Z
  5. * brief  EDMA3 Test Application
    + d8 H4 T6 O* y) N6 d. j
  6. *9 K* d* g6 _" M
  7. *   This file contains EDMA3 Test code.+ b2 k6 K, h0 y
  8. *5 f! q# v. N/ o* r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; ~3 z5 t6 {$ e: Y4 y+ `  i4 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # K/ }$ G9 E) t& i7 J
  11. *         TO CHANGE.2 H( J. N% _' E( I" X- O
  12. *5 _3 E* b# b; k) B- q; E7 t5 o8 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' X1 A& d( l( o) u
  14. *
    - {. M3 p6 h1 O- Q
  15. * This program is free software; you can redistribute it and/or
    9 D7 W# L! ^6 a
  16. * modify it under the terms of the GNU General Public License as* C) i) V& A7 M. z$ Q
  17. * published by the Free Software Foundation version 2.
    ) \$ ^# ?. K* Z) \
  18. *
      z& E" P; U  W9 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " H+ `$ K) @0 u8 A! W
  20. * kind, whether express or implied; without even the implied warranty, I- c  |7 Y- V; I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : R$ \$ b; ~7 |2 U, `+ k, N
  22. * GNU General Public License for more details.
    . r: N4 [' A+ i! B
  23. */
    $ @+ z9 ]. h7 _& i  n
  24. 0 m6 E! G1 {; Y4 l0 Y- _
  25. #include <linux/module.h>$ V' ]% S2 ^% V3 X
  26. #include <linux/init.h>
    8 R+ X- k( X6 s( ?  M
  27. #include <linux/errno.h>
    4 V0 h; |# h0 s" t" }) l" k4 [
  28. #include <linux/types.h>
    " d9 `! l& q) T3 p
  29. #include <linux/interrupt.h>+ w% ~! F7 k; [. R+ l1 u
  30. #include <asm/io.h>
    : |  o/ [, }6 [2 z' L( ~4 N( k
  31. #include <linux/moduleparam.h>
    4 j! n# [! u, @: j$ L$ W2 G2 G
  32. #include <linux/sysctl.h>
    2 `; }2 F" P* C4 i' \# m
  33. #include <linux/mm.h>
    0 ]% ]9 m- W; [$ ?2 H
  34. #include <linux/dma-mapping.h>
    ) d+ t) E  B4 X) `0 q- p9 Y
  35. 5 O0 M1 X& K% T! N) E! z0 ^. \
  36. #include <mach/memory.h>6 v1 H! d! D$ M
  37. #include <mach/hardware.h>7 U% ^2 y& P  k* j2 k8 V
  38. #include <mach/irqs.h>, J$ w/ T5 F' X1 v
  39. #include <asm/hardware/edma.h>8 F" d) }8 o4 }6 s" j

  40. + y5 k, N* }6 R, P( l' J1 y* A9 d& i' o
  41. #undef EDMA3_DEBUG
    3 n/ I4 M. R, H; ?. w" y
  42. /*#define EDMA3_DEBUG*/
    & k9 M5 q- f, ?: {, H( r
  43. 9 @4 r- N- E8 L" J' r+ J5 d
  44. #ifdef EDMA3_DEBUG& c. f% {5 v2 X: J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' X( J4 x! A, U! ^& _& M9 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % [0 K: W  e1 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 C$ J! t1 d1 _
  48. #else
      H2 H" \0 o! L3 P! N
  49. #define DMA_PRINTK( x... )9 u, L) C, W$ {1 x4 j& c# a
  50. #define DMA_FN_IN
    0 F3 Z& c" H1 P) z& B
  51. #define DMA_FN_OUT
    ' }# v  Z3 `( L2 l9 c
  52. #endif
      S3 [0 Q/ s6 x6 O
  53. 8 i6 D7 ?0 A1 v7 x& c+ V  A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; v! l7 D6 J7 D9 Z' r
  55. #define STATIC_SHIFT                3
    1 C  L& t" ]8 q3 J
  56. #define TCINTEN_SHIFT               20
    2 A* _% i, h, _' V+ `! D
  57. #define ITCINTEN_SHIFT              21; n' d/ e5 g- O
  58. #define TCCHEN_SHIFT                22
    ' ?! n/ a) l. L( ^6 ~
  59. #define ITCCHEN_SHIFT               23
    * z  P# z; \9 \5 V
  60. * b( S; l% M+ F. u1 Z
  61. static volatile int irqraised1 = 0;
    6 c* I7 S* t. l0 H' J/ t
  62. static volatile int irqraised2 = 0;
    0 Z$ H/ t! c& J: G4 j/ q" i& w
  63. ( [+ Y3 {" }) y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * D- c7 Y* X2 _0 `3 y0 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 U2 B, y5 h/ B! ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& G% o: ~3 [( o: a6 H
  67. 6 _+ i( h" n0 v
  68. dma_addr_t dmaphyssrc1 = 0;
    / v! D5 G8 w( d0 m+ j; S/ s) h
  69. dma_addr_t dmaphyssrc2 = 0;0 X5 h7 i  ]# J4 s% W% v
  70. dma_addr_t dmaphysdest1 = 0;0 |$ F6 s0 m  W/ V* F
  71. dma_addr_t dmaphysdest2 = 0;1 E4 Z; `8 z  q" M# m4 s* X/ D0 F

  72. 5 W9 ]( j/ q9 m8 \! _! `
  73. char *dmabufsrc1 = NULL;' I, O, {+ d8 ]: J  E* ?
  74. char *dmabufsrc2 = NULL;4 |( P& L' p; N6 ?+ C; S2 ^, O
  75. char *dmabufdest1 = NULL;
    8 ~- [9 p$ C) K4 n' h
  76. char *dmabufdest2 = NULL;  d9 D- O7 ~9 Y% O) p. |1 c- c+ f
  77. # U/ @* e7 D' o" q  Q! i# ^
  78. static int acnt = 512;( p3 i+ Z+ _2 _
  79. static int bcnt = 8;
    & e" S( a" D( n  m& ]5 `/ \0 B) Q
  80. static int ccnt = 8;& Y( a# w& L" J3 r$ b2 H/ C7 x

  81. 9 [  `7 k8 R0 {2 p* @" @% b
  82. module_param(acnt, int, S_IRUGO);
    ! [( [  H9 F3 Q9 V
  83. module_param(bcnt, int, S_IRUGO);
    ' e5 k; r7 W1 }* m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 r  v- c1 x; k9 c! o) T: h+ A* ~9 n
: B. ?) l& w! J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F! ~8 n/ i& z% F3 Q- f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, p1 O) p, S* s4 n8 M5 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 n' T, |! b) j7 W

0 M, }+ S  J' _6 F0 w! `# N% j, r9 ?) ~5 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 06:01 , Processed in 0.040019 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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