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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Z$ [. m7 `; i: C# V6 O
  1. [code]EDMA sample test application
    ! y. |4 A1 H6 ^/ w9 ]! j! E9 L
  2. /*
    ' K0 ~) G$ w7 X( c
  3. * edma_test.c, K. t! ?' {3 J/ t. h8 d
  4. ** C- ]7 O$ ?8 ?- z1 u0 s! C
  5. * brief  EDMA3 Test Application  Z* o" y. k4 u, x
  6. *4 m. T2 W  w7 m# x8 X
  7. *   This file contains EDMA3 Test code.: f% h( r- l& a8 `: ~! ]
  8. *
    + A( P* o6 S. U' _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, I5 |2 ?  J5 y9 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 C* z5 p/ T8 \8 t" l
  11. *         TO CHANGE.0 t# I0 k$ Y3 t! j5 [9 ]
  12. *
    : @' Q: t8 C8 L& T0 b$ V: X: U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: }7 _6 [& u1 i$ b
  14. *
    ' N$ k* m+ ]. O; D, g+ d0 p& {3 F
  15. * This program is free software; you can redistribute it and/or7 m( M3 n# V( w+ K' O
  16. * modify it under the terms of the GNU General Public License as
    6 i. {0 @" x  g0 A7 C8 O
  17. * published by the Free Software Foundation version 2.  e. }. C& Z- {& \* `7 N: t- [
  18. *
    $ _, _3 }+ ], `: L/ s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. n& h  ]5 O9 g" N9 ]2 n
  20. * kind, whether express or implied; without even the implied warranty' v# e5 J8 V( M' {; \: g  K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- r0 s) v3 b; q8 [" v/ v; j$ {
  22. * GNU General Public License for more details.
    2 [5 P; d8 [, V/ h
  23. */7 k3 x8 C: l$ R* v8 r

  24. ! C: H3 T1 N! q
  25. #include <linux/module.h>& l; b4 p7 N! k$ o. \
  26. #include <linux/init.h>& h& [. h! O% a" O( W# A6 G: a
  27. #include <linux/errno.h>( y9 F, }) E$ g5 n; a
  28. #include <linux/types.h>
    . o& u7 S( v/ @" Z& E2 O* S% j2 N3 |
  29. #include <linux/interrupt.h>4 u. n8 S5 M" t9 h* E4 Y
  30. #include <asm/io.h>
    6 O% I8 x4 A6 D  B( P$ h3 h
  31. #include <linux/moduleparam.h>
    7 s) c3 a/ R* x- Q1 [; q
  32. #include <linux/sysctl.h>
    + I& G* c! s9 M) x6 V' V
  33. #include <linux/mm.h>! S' s& j6 o. i
  34. #include <linux/dma-mapping.h>, T: S. @. q- \( o

  35. / I' h" a, z- D$ g% p6 P8 C
  36. #include <mach/memory.h>& C1 m1 x/ E8 ]/ q# J- _) l
  37. #include <mach/hardware.h>
    0 J& W) l% O' H( C8 p8 N+ l
  38. #include <mach/irqs.h>0 o: v( O# y" A- Z8 m6 f
  39. #include <asm/hardware/edma.h>
    . Y/ f. J0 ]2 t+ M

  40. 9 K, L# E/ c" s' S. h: A$ R$ I
  41. #undef EDMA3_DEBUG. L* [2 @3 V* z) K
  42. /*#define EDMA3_DEBUG*/
    1 \6 d  g' i1 R" a5 r8 c4 S

  43. ; z8 `, d/ ~* I8 n; b6 U" c
  44. #ifdef EDMA3_DEBUG
    ( U3 y7 b% `3 h( H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' Y3 H* s8 ]) `( {# L& p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 F* y4 L8 _( V7 R5 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ V' |( m0 X7 v% [( i7 K; ~
  48. #else' Y* D, c. }% q+ @) J5 K1 g1 c' j, G
  49. #define DMA_PRINTK( x... )
    . `, d. H5 b* J
  50. #define DMA_FN_IN
    ' `4 u+ K+ P2 @' u; `+ C
  51. #define DMA_FN_OUT# q5 {, K1 r) V
  52. #endif3 y1 G! `* H8 V0 v" c6 ^3 J

  53. 8 l0 C9 {9 {9 @# V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" X) O9 K# \& D6 e  \- K% z
  55. #define STATIC_SHIFT                3) B/ t  |4 J6 e' [, M  f
  56. #define TCINTEN_SHIFT               205 i6 t% z) F9 [
  57. #define ITCINTEN_SHIFT              21
    $ k0 N) \9 M1 b. _) d1 w3 y
  58. #define TCCHEN_SHIFT                22
    & J, j/ F" ^9 |! Z1 S
  59. #define ITCCHEN_SHIFT               23
    & i2 T: D4 n) Z5 L8 e

  60. , q6 A1 p' ?1 K( V% t
  61. static volatile int irqraised1 = 0;
    & J" U0 B7 b8 [6 w
  62. static volatile int irqraised2 = 0;! a! j& l) [5 X2 ]5 A+ r

  63. ! g/ d# M2 Y$ C/ M2 T" s; _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D3 e& Y: i  Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 V7 t4 V, N. I8 X/ F  M& A3 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 _' b5 C% M. T+ U8 Z$ B

  67. ) P" W4 R+ X! q; n7 w) o
  68. dma_addr_t dmaphyssrc1 = 0;5 _/ V- z$ E6 X: d) l
  69. dma_addr_t dmaphyssrc2 = 0;
    # L0 v. |9 a! n/ k: D0 h. @" Y
  70. dma_addr_t dmaphysdest1 = 0;* e: }5 v2 j6 b+ U3 {
  71. dma_addr_t dmaphysdest2 = 0;7 S+ R: M& U& p1 Z6 e% f
  72. " y+ N: _) f# r7 _7 S9 Q
  73. char *dmabufsrc1 = NULL;+ t3 v* l% y, `* \3 h) {& A  ~& L2 X( |
  74. char *dmabufsrc2 = NULL;/ X- Q' G# y& H; p
  75. char *dmabufdest1 = NULL;/ W5 k$ X" k1 B
  76. char *dmabufdest2 = NULL;
      I" A, I' j6 T8 R
  77. & e# t, {  Z6 Q
  78. static int acnt = 512;! w) ]) h% k( l0 u& m8 x
  79. static int bcnt = 8;
    2 n9 F+ J, C) N  n# C, h5 N' }7 }$ q8 _
  80. static int ccnt = 8;/ [8 J) T, h9 H

  81. ! L0 [9 @9 B) \) b% Y
  82. module_param(acnt, int, S_IRUGO);" ]. O; I2 m. c. D8 S" N: Y& C  s( K
  83. module_param(bcnt, int, S_IRUGO);
    ! `3 W, r, b( o! F7 u2 P/ \/ E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& L: L8 \! z' U. i
9 F: y) x: c- l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( r1 Q5 \3 o& P$ ~! B8 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, X0 B8 _, j3 f: H; v9 Z) q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 v+ F, O/ R$ U, @* \/ D
! ~7 g4 b; T- p/ \. |2 P* A
0 l& H0 j7 m# m" Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 06:37 , Processed in 0.044342 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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