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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Y, |  l2 n: F# F; A
  1. [code]EDMA sample test application
    4 N1 a3 Y, w% v  W. k) N9 f
  2. /*, Z" C$ X' |0 N( i( @4 g
  3. * edma_test.c
    0 [# E7 K2 d  s( H/ V3 o* r
  4. *5 @  ]9 k8 H' Q. `7 u6 G" x
  5. * brief  EDMA3 Test Application
    2 ^- Z9 ^& C9 c* s4 P' {
  6. *
    $ G3 j, Y1 T+ W* I2 v& E1 f1 j
  7. *   This file contains EDMA3 Test code.1 j! n. i+ C4 d! Z6 ~7 g  R+ Q
  8. *8 S! M( |3 x6 M+ T$ E6 F( ?9 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  O( [, `# b  I" x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 Z) G+ d3 N1 e( x
  11. *         TO CHANGE./ G1 \# C. R+ `+ n6 v" T- O
  12. *  ^/ B$ u' W9 S1 G9 \9 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 _1 j1 N: [- t1 N0 t; P
  14. *& Z1 s8 [! F" W$ Z6 |
  15. * This program is free software; you can redistribute it and/or% D" @9 U7 T0 ?( l1 _0 c5 Z0 d* s
  16. * modify it under the terms of the GNU General Public License as& S) p1 B/ n/ J5 w0 `4 U
  17. * published by the Free Software Foundation version 2.' s3 d* X7 Q4 w- {* j3 O7 {  {
  18. *
    ! m9 Y$ V$ [) l% N8 n3 ?! r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( Y- s% ]- d# B2 V) Z+ n
  20. * kind, whether express or implied; without even the implied warranty
    - h* s# _. [8 A0 E* K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # v0 m/ H9 F0 t: x9 `+ r0 W
  22. * GNU General Public License for more details.2 |9 K5 `7 w1 B# r
  23. */
    $ G* \/ Q) z$ \, a0 w) Y& w+ u

  24. ' w' k* ?* F: j: b  y- V; L4 y" n
  25. #include <linux/module.h>! a0 W0 z( Y' O3 }, T6 d
  26. #include <linux/init.h>
    6 i  y: i5 g- {/ ]) u1 [
  27. #include <linux/errno.h>
    4 R4 [0 M5 G! g( D
  28. #include <linux/types.h>
    0 n' ]* H. Q" z# F  H9 X: w
  29. #include <linux/interrupt.h>
    6 D, B2 F5 Y& \4 `  k+ U) k
  30. #include <asm/io.h>
    6 P7 z: p: O+ l1 l5 x3 z' L/ q4 x9 `
  31. #include <linux/moduleparam.h>4 h* `+ }$ J' n! l9 ~" I
  32. #include <linux/sysctl.h>
    / e" P" K$ s1 h5 c/ n* H
  33. #include <linux/mm.h>$ H; ~$ D' L' Z4 O* o; ^) Z! B: y; q1 s
  34. #include <linux/dma-mapping.h>
    " z6 R$ o  X' h3 J; T! r

  35. + f" ?. B8 b1 M" o# i
  36. #include <mach/memory.h>+ F$ |: F+ T4 E% S
  37. #include <mach/hardware.h>
    9 X9 A# j/ U  `7 `# r: D& x
  38. #include <mach/irqs.h>
    / v/ O/ I1 {. i/ \
  39. #include <asm/hardware/edma.h>
    6 Q& V, j7 r- Y* i  W) K
  40. 7 j: M6 T+ v6 u) [' j; O: ~
  41. #undef EDMA3_DEBUG
    , \' W' K, J; y! b! }' b- X/ J
  42. /*#define EDMA3_DEBUG*/
    " t  u6 Q3 o/ o  q$ N: D8 H

  43. & c8 z' k5 j1 L& W5 M% u- f% X
  44. #ifdef EDMA3_DEBUG& O; u- M' o. b" o% Y( _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). n' q+ E0 i5 ]$ ]& {$ t8 h% ]& R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 T. J9 f6 F! t# o, V& d4 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; G6 C* t; |* F$ W
  48. #else
    " F, c% H( S) A  K
  49. #define DMA_PRINTK( x... )# l; t+ T2 Q( q
  50. #define DMA_FN_IN
    , K0 J! S  n, j9 F8 T
  51. #define DMA_FN_OUT
    : }7 }4 ~! W% I: i3 C: ^1 S; m
  52. #endif' Z4 i: \. D% G! K3 R
  53. * `+ A0 R  S2 x( G) R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + L1 }! N" b# b6 o2 s# ~
  55. #define STATIC_SHIFT                3. `! c2 U# H, @( a6 W
  56. #define TCINTEN_SHIFT               20
    ) j. Q) L! R* `3 z
  57. #define ITCINTEN_SHIFT              21$ b8 y, S) A. Q
  58. #define TCCHEN_SHIFT                22! E* L$ a# e$ @7 @( G
  59. #define ITCCHEN_SHIFT               23
    . ^9 \$ Y7 R2 d# M" c( V2 v
  60. 3 K; S' o; \! @. d& \7 o# H8 q* g
  61. static volatile int irqraised1 = 0;
    9 {; [8 O/ c4 ^' K0 H% U9 R
  62. static volatile int irqraised2 = 0;; B3 L# ~! v3 N9 H; f6 M

  63. 1 p+ ~8 t9 c+ w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s* h- ^5 K5 F$ R) H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 K3 V; H' G( H* b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T) e5 N! u5 @  t5 E1 P8 k

  67. # U: S( V! K: @0 k0 a: n* C% \, N
  68. dma_addr_t dmaphyssrc1 = 0;
    - f) ?* O) D, C8 v
  69. dma_addr_t dmaphyssrc2 = 0;
      I: y# q6 B! P
  70. dma_addr_t dmaphysdest1 = 0;
    0 A  [4 D. R- R9 I$ u
  71. dma_addr_t dmaphysdest2 = 0;
    : I7 O; b2 U- Y7 c+ U: o
  72. . r/ S# {) L/ S+ m
  73. char *dmabufsrc1 = NULL;
    # X4 z8 h( }" R
  74. char *dmabufsrc2 = NULL;
    1 a( N$ d0 N; K2 u0 `8 _; r
  75. char *dmabufdest1 = NULL;
    , {  T  u% m3 J9 O1 b
  76. char *dmabufdest2 = NULL;
    / @& G. T1 L9 l+ M, F
  77. $ t1 t# Y" }! h; |8 t! o1 R
  78. static int acnt = 512;
    ' e! a+ W5 ]9 p$ |' N
  79. static int bcnt = 8;
    ( @' r4 X  R8 R# g1 n8 S0 Q  F8 H7 s
  80. static int ccnt = 8;
    # r% S7 L! \( h  b& u* x6 [7 a: s
  81. 1 b7 r9 C( Q/ ^7 P8 @) H
  82. module_param(acnt, int, S_IRUGO);
    : Y6 @8 [! P! J+ n
  83. module_param(bcnt, int, S_IRUGO);' [5 U" a) L/ q0 Y' x9 b9 A& z! o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& X3 O2 ]" L3 a; D, f8 |* x

! D8 m: v  m5 p6 b& r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ i; _& j$ P' L% B4 g% o3 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V" C; v9 t1 J+ L+ K, L1 ^2 m) ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& O* v9 n9 q' f7 h  k8 i6 r9 W) U
/ v" h7 w+ u1 q3 Z  l- z  e

& ?4 h* O, P1 \+ H3 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 21:46 , Processed in 0.048811 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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