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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- S% e+ E9 d5 Y
  1. [code]EDMA sample test application5 `6 s& V9 m) F; |
  2. /*
    & y9 k  y( ]2 E8 }% V( R: o
  3. * edma_test.c1 }% l6 Y7 R9 k
  4. *
    ' P" `1 j8 }2 O, `3 m
  5. * brief  EDMA3 Test Application
    3 r- d$ ?1 [9 K
  6. *
    + m1 w* E+ F* U4 O2 D
  7. *   This file contains EDMA3 Test code.
    ) y- t/ n, w: L
  8. *2 ~0 {& G! N2 [' t1 I: }0 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) T( W  |/ H1 L- Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 P' ~8 W7 b1 R; N9 k$ u
  11. *         TO CHANGE.. F% C  L: A2 U' F+ g
  12. *6 G+ U0 L! n: ]9 B$ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 u0 N1 T0 @1 @) R$ X2 O4 Z/ r6 j
  14. *
    / z- O! z7 A; o  |' l; l
  15. * This program is free software; you can redistribute it and/or5 A% t# {1 a# r7 V
  16. * modify it under the terms of the GNU General Public License as
    5 I# W) O* r3 u0 b7 y  s
  17. * published by the Free Software Foundation version 2.4 x* f; R$ o5 f+ F, P8 \$ R- s
  18. *
    2 o. i% J7 t) ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - \8 V# R$ U6 Z9 l; F
  20. * kind, whether express or implied; without even the implied warranty
    % I1 c/ M) I% P& z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . z! M' ~: w4 m' c6 C
  22. * GNU General Public License for more details.
      M1 k, W7 p2 A+ {3 F6 R
  23. */
    ( S& r( X3 k( [" U3 S

  24. - R  J) U2 N# ?, p) C7 X
  25. #include <linux/module.h>  N7 {) W0 A  M; y& ~' [
  26. #include <linux/init.h>) n! ]: y6 E1 f9 e) Q8 k, l
  27. #include <linux/errno.h>9 ]9 v+ D3 e- }) u: o& P
  28. #include <linux/types.h>
    - i" d! R; x& x' x. O  g" p
  29. #include <linux/interrupt.h>5 `- o4 A! t3 p' i% O2 m
  30. #include <asm/io.h>
    / m! @: W1 X" s4 l) F( T) `5 q
  31. #include <linux/moduleparam.h>
    ) ~2 }6 T9 f: j: b! F4 N! J9 D+ [
  32. #include <linux/sysctl.h>
    $ o% D5 \. R% C, G3 U. j( J
  33. #include <linux/mm.h>
    + c; n6 ~* T# f7 S' U8 z9 ]
  34. #include <linux/dma-mapping.h>
    9 F9 N% K9 O6 O2 ]
  35. 7 U6 A/ Y) B4 |6 Q
  36. #include <mach/memory.h>
    ; A5 J1 u3 H" y6 }8 ]
  37. #include <mach/hardware.h>+ k, Z2 V3 s, e; u' @
  38. #include <mach/irqs.h>
    - {( t2 x! n* Q$ p8 j) ]
  39. #include <asm/hardware/edma.h>2 {. g$ C0 k( A6 {3 z' q; t  b9 p
  40.   l9 t. x9 x/ H; \+ s% c, A* E) F
  41. #undef EDMA3_DEBUG
    4 n# }7 ]' q* k3 P1 A0 B/ T. N
  42. /*#define EDMA3_DEBUG*/
    3 z8 H5 x" y+ D% O

  43. % P/ ^% C; e0 m8 B
  44. #ifdef EDMA3_DEBUG  w8 U* |6 |3 o& j6 F$ K" w: ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ w: V  _% F8 ^& N& P1 o5 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 y1 i- |$ f) ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) n/ Y. v, d9 f2 I2 Z- k# q
  48. #else9 ?4 `6 E/ b$ G+ h; s1 o. m
  49. #define DMA_PRINTK( x... )
    4 Q5 X1 S, _' ~& S# L. O
  50. #define DMA_FN_IN8 O5 a2 V# v, Y8 p8 Q
  51. #define DMA_FN_OUT/ T, W* F+ ?1 I, i) C+ S
  52. #endif
    ! p# i' L* x3 c

  53. % O. u; |, H# G* z0 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! T6 H" p/ w' V
  55. #define STATIC_SHIFT                3# W0 A9 m  f8 k% F
  56. #define TCINTEN_SHIFT               20- }" e, Z2 m  G( i0 }
  57. #define ITCINTEN_SHIFT              21
    ) s* h, y) B" }4 e3 }- ?
  58. #define TCCHEN_SHIFT                22' L% S" e9 k( d6 k" X* {
  59. #define ITCCHEN_SHIFT               23
    0 j9 L! ~1 y8 r/ {

  60. 5 O: X$ q# s" j# X, J9 a
  61. static volatile int irqraised1 = 0;
    1 N: X5 M2 ]& b5 Z' l
  62. static volatile int irqraised2 = 0;) _2 {6 J( Z1 [! T- f% _
  63. - U' p1 O9 x* v! w0 g+ d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) e$ w4 c$ q- y+ Z: N5 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! f1 p' ]+ g" r" f" @4 w+ ]  e( n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " [; W2 ]' O' Y3 r  S: Z
  67. # `1 J6 _0 N: H$ O* G& U* _
  68. dma_addr_t dmaphyssrc1 = 0;
    * r" o# ?+ e& ]6 z, N
  69. dma_addr_t dmaphyssrc2 = 0;: D5 I' @5 u2 E0 F5 H& j, @
  70. dma_addr_t dmaphysdest1 = 0;
    & I( M5 f& L% @% j
  71. dma_addr_t dmaphysdest2 = 0;
    8 o( k5 m" |" Y9 {, |, D8 n
  72. 1 ?& u7 `" T! v
  73. char *dmabufsrc1 = NULL;$ u% J2 V3 a3 E# x. }  U' w
  74. char *dmabufsrc2 = NULL;
    1 |6 v7 S: w- K9 ]4 k, `
  75. char *dmabufdest1 = NULL;
    $ c' e* ?2 Q0 W
  76. char *dmabufdest2 = NULL;) b) G# c* A7 r+ Q* e
  77. ; V; h! n# |+ z5 V$ H- r' O
  78. static int acnt = 512;
    " w9 r. w8 V3 Y
  79. static int bcnt = 8;
    & {- L. D5 n9 z) S
  80. static int ccnt = 8;. i' |7 V4 ?5 z8 G7 x# f* n) P
  81. & o" ~5 R5 J* C1 B1 C1 g7 O4 A) ~
  82. module_param(acnt, int, S_IRUGO);9 `. t: C5 [: o% w( k" Z/ T
  83. module_param(bcnt, int, S_IRUGO);
      O# k! d& s  X) h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 Y# e& z5 D% Y) v* s/ S
& P- @% D; H0 \2 {; C; g# H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 G5 i0 C0 Y+ A- n; {. Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, i  P8 y5 \$ ]$ [0 }5 I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' Z$ b$ R9 o9 i- g- S% T) f# t8 n4 s* p# {8 k; \# g, ^
( V2 Z9 S4 G( a! f! ?' G# k2 O+ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 10:22 , Processed in 0.044882 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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