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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 I1 ]4 {+ c6 H
  1. [code]EDMA sample test application4 D- ^6 O$ X- O: p/ K3 h* ]
  2. /*
    2 G/ N) X2 B, S, k6 `0 H" `: f
  3. * edma_test.c
    % T5 f' ^# {, k1 E/ n) T, I( W/ y: c4 u
  4. *1 f6 Z0 q( G( t- }
  5. * brief  EDMA3 Test Application
    . l, C. Q- C/ ?: y
  6. */ D- c' d% d7 u3 M$ c, I( ^
  7. *   This file contains EDMA3 Test code.
    # L) \( ~& ]/ ^: t* ?2 ]
  8. *
    & i2 J% V( a0 |( l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ Y, w" e" Q/ J6 _) p/ x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & d* q9 R6 _( r6 t
  11. *         TO CHANGE.
    2 R2 O1 g+ o. o3 |! _& M- k
  12. *
    + {" |& B1 Q6 W3 p. Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) X$ a9 _2 [3 m! g! {# {
  14. *8 n, y9 e8 T% F6 b3 y7 y, k, |
  15. * This program is free software; you can redistribute it and/or
    ; d; n( M- K! Z6 p3 b' }4 v7 I! w
  16. * modify it under the terms of the GNU General Public License as$ \. v7 b: C" Y7 x$ u9 U
  17. * published by the Free Software Foundation version 2.
    6 Z& G; t3 q. W: A& z, j1 ?
  18. *
    ; W( ^. f) ~9 {+ p5 I8 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 k5 R" \* z1 [( T. Z4 c
  20. * kind, whether express or implied; without even the implied warranty( M: @+ c' F3 e6 Q1 E* }' d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 v/ B8 H. {+ }% s, z2 K! T6 \
  22. * GNU General Public License for more details.
    ' s3 d; h/ n( a6 X
  23. */
    ) f* u2 @: {6 {  O% H
  24. + o+ h6 g  U7 t% r3 B# b4 }8 V
  25. #include <linux/module.h>. [7 X' Q1 S! w
  26. #include <linux/init.h>
    8 @  B# N. Q% M
  27. #include <linux/errno.h>: c# P) j) v! d) z, f
  28. #include <linux/types.h>
    / i5 T  H1 C* I5 i4 l
  29. #include <linux/interrupt.h>
    * d) X9 u9 _9 U7 r
  30. #include <asm/io.h>0 Z6 M, A4 s. o3 y' u) l* t
  31. #include <linux/moduleparam.h>
    2 y. V8 {, a: y  H3 A7 S0 }
  32. #include <linux/sysctl.h>
    . D0 P3 F5 I2 v/ Q" r- A
  33. #include <linux/mm.h>
    . o5 ~  J' n" W& J6 q
  34. #include <linux/dma-mapping.h>6 D* D5 Z. [* k

  35. / L! x3 e0 z5 E+ l5 s! C
  36. #include <mach/memory.h>1 P( g3 x" L7 c4 V7 v
  37. #include <mach/hardware.h>
    ( c9 H" r# Y$ O' ^
  38. #include <mach/irqs.h>
    - }* D- F( Y) b+ k- ]
  39. #include <asm/hardware/edma.h>
    8 t" Q% X0 ^8 [0 j- _$ y: I* P& n' E
  40. 4 X% R0 A. w. h; o% |
  41. #undef EDMA3_DEBUG
    " T- A  v- V% U! i7 L/ H
  42. /*#define EDMA3_DEBUG*/
    / C0 C9 B+ _; |5 U8 I  X7 U) O
  43. 0 N, w# n* `$ a) s3 X4 x+ u7 s* C
  44. #ifdef EDMA3_DEBUG
    " d0 g7 F+ H5 u2 z! t4 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - i1 w) [, }9 N( `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' }& {* \" P( o1 z( z% \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  T- F( J9 B0 L8 A! C8 p- Y+ Z! k
  48. #else
    . I. S5 ~4 n. h9 _
  49. #define DMA_PRINTK( x... )" \0 U' O5 A1 z3 E7 N" x
  50. #define DMA_FN_IN
    ) a" y* z1 Q1 e- l
  51. #define DMA_FN_OUT0 w) ]5 @/ v4 n3 w1 ~0 A
  52. #endif
    & }, z4 H) j% G; N- W

  53. 1 y/ F- D3 c' b+ f6 S$ i1 I- ^2 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 x7 h- E! W$ E' C
  55. #define STATIC_SHIFT                3* Z1 P+ E* V1 e" [: `+ _( F
  56. #define TCINTEN_SHIFT               20
    ! X# Q3 I3 [: e1 X" j2 I
  57. #define ITCINTEN_SHIFT              215 ^. d8 K( X& S% o$ H
  58. #define TCCHEN_SHIFT                22
    - C+ t* e- o9 @+ A! `* b
  59. #define ITCCHEN_SHIFT               236 B& ^/ G2 j6 v: [$ A
  60. 8 p( x* E1 K" C9 T$ ]: o" [  b- z
  61. static volatile int irqraised1 = 0;
    ) i7 Y' R9 s% ^& n' q& g; ~
  62. static volatile int irqraised2 = 0;
    , v( \( O7 d  T5 r) m( V

  63. & A# {! G2 T5 [4 d" a- l* l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ^+ T' e' ]- ^  o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& \3 a3 G# z' v4 X3 v/ v% b, n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      s, ^: K! B9 S1 f& s6 Q1 e

  67. 4 Y1 `# D' l. _! R
  68. dma_addr_t dmaphyssrc1 = 0;" x0 u# s/ J) n2 u
  69. dma_addr_t dmaphyssrc2 = 0;
    ; C5 x- C& m6 S
  70. dma_addr_t dmaphysdest1 = 0;1 F  ^! t! A. |! [1 R
  71. dma_addr_t dmaphysdest2 = 0;
    ; ?, {% t1 g& `% l: Q

  72. ( n; m0 h5 j# o7 u( R! _
  73. char *dmabufsrc1 = NULL;
    1 ?( D& X' }1 }5 `# Q- O4 Z8 |# J
  74. char *dmabufsrc2 = NULL;
    , m) g, K, O4 d6 P
  75. char *dmabufdest1 = NULL;
    8 F" A3 y; f; u* i7 z' @
  76. char *dmabufdest2 = NULL;  b3 \% C" y5 f' C, g
  77. 4 P9 l$ h* n9 A
  78. static int acnt = 512;
    7 e5 x, q7 F0 |& N
  79. static int bcnt = 8;) `, f+ g2 ^7 Y, R1 ]6 n
  80. static int ccnt = 8;9 s: B0 `9 F$ o! z

  81. * k$ f, Z" L0 G# e& P( L+ `
  82. module_param(acnt, int, S_IRUGO);' d3 D- \% X3 d' z/ n# N
  83. module_param(bcnt, int, S_IRUGO);0 d# C( g; A. G3 Q( X9 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' W6 z/ g( c% Y( t8 ]6 f
; l& }$ e* x: E% _4 Z6 `4 z$ x! s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 {/ C. h* O5 ]2 B" V) k% Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 M4 f  y/ g- F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& X# [) }1 ~6 ]3 K5 Z0 c, d$ S0 p( N; v% G
: \3 U" l  }* v0 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 21:51 , Processed in 0.038728 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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