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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 y1 i9 L" s* d( h7 q  B+ ^: d% O; K
  1. [code]EDMA sample test application. C) K6 r# B% |. K, F" q
  2. /*
    " N4 M8 n7 F" R# p
  3. * edma_test.c
    $ x, K9 L4 ], Q: D
  4. *
    5 u# H* h( f+ H) @7 @; O
  5. * brief  EDMA3 Test Application( k, c& ]2 Y% `$ W
  6. *: Y7 g0 P# F1 O) G6 Z: W" p1 Q  F+ U
  7. *   This file contains EDMA3 Test code.4 X: Y" P, B6 E) |
  8. *
    0 _. N! M; C7 r! A' a  j" |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( W$ r" Y- }* y6 F+ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 @& K1 M$ f' ^" I/ e' y* I
  11. *         TO CHANGE.
    5 [8 _" Y6 F) d* u0 V
  12. *& T- u- c9 D) c2 N6 m/ c: l$ x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 a: o& r+ O; ]: K3 U
  14. *
      O' q4 p$ y5 [" {7 P/ k
  15. * This program is free software; you can redistribute it and/or) X+ `2 L+ g' O9 R1 V" }- N
  16. * modify it under the terms of the GNU General Public License as
    % _& S( |; R2 r% j' W" z( w
  17. * published by the Free Software Foundation version 2.
    6 P- `$ Q4 k. Q. A) g- m; R' T
  18. *
    0 V  m$ T" B+ b' L( X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 Z0 _1 L( L( V$ P7 e
  20. * kind, whether express or implied; without even the implied warranty: W$ x! K0 g: }: E/ j6 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 V: |' @$ }$ \
  22. * GNU General Public License for more details.4 ~! P0 B3 O7 ~  l
  23. */
    # z: }7 K- d, S3 ~2 m8 |

  24. $ x& ^, H0 _: ^5 i0 }" {1 c! Y
  25. #include <linux/module.h>7 l$ M  G* U0 c$ r
  26. #include <linux/init.h>" m; j: x' g+ j& F. v$ s
  27. #include <linux/errno.h>
    2 f1 E- S9 b' l5 C2 a
  28. #include <linux/types.h>3 f( S# q2 L1 y; E$ b
  29. #include <linux/interrupt.h>5 \6 i& {5 o  H9 ^
  30. #include <asm/io.h>
    / p) S( t/ Z, y' M& f/ ?
  31. #include <linux/moduleparam.h>2 g0 D+ J4 S% T
  32. #include <linux/sysctl.h>
    - n% i  y: n: E# h, A5 D8 {) n7 h
  33. #include <linux/mm.h>3 l- j" ?# @/ p5 [' w+ f
  34. #include <linux/dma-mapping.h>
    % n& l, b# I- n+ y( w/ w* `

  35. % _1 P. L# |; l- q7 w- \) b% ]! P
  36. #include <mach/memory.h>
    * B3 E- H. Y  n+ s/ ^2 Y
  37. #include <mach/hardware.h>
    2 j/ I! s* j$ R& z  K
  38. #include <mach/irqs.h>
    $ Q5 |5 _" R- Z! }) J: x  L+ [
  39. #include <asm/hardware/edma.h>! a$ i9 G, y0 [! a& f

  40. ( l! `. A* O0 _5 Q% K! g! G' r
  41. #undef EDMA3_DEBUG5 y# g8 A) _1 q/ i, y& x6 x
  42. /*#define EDMA3_DEBUG*/
    . O/ ^, D/ k) y6 G
  43. " x5 ]/ S0 r! A) q' i. ]3 q/ |! z# |
  44. #ifdef EDMA3_DEBUG
    3 q: Z8 {$ j, l8 Q7 W& _2 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * n" R) Y9 l+ M1 u" A- M/ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 b0 G6 S: h& U, X& I5 s# f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ]* l" e( H" m0 i& R* W- U$ R
  48. #else* b$ c1 F5 s. U2 }' Q& R) l
  49. #define DMA_PRINTK( x... )
    7 A" U& ~" X0 W" \9 h# ?
  50. #define DMA_FN_IN
    & D0 N: \3 a9 C6 @6 x4 U' z5 ^% S
  51. #define DMA_FN_OUT2 c8 A( N  J4 w' j5 L6 z7 Y
  52. #endif4 M: o% ]* I7 f$ g2 J

  53. 3 C, I+ O- l7 s6 x: T/ G0 L1 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ j4 W7 C6 ~: y. x* Q$ }* ^
  55. #define STATIC_SHIFT                3( f9 v* X% B2 `  a
  56. #define TCINTEN_SHIFT               20
    7 c+ Z$ ~" y: }% ?1 z
  57. #define ITCINTEN_SHIFT              21+ a( z$ G" Q# p% w0 k5 L  k
  58. #define TCCHEN_SHIFT                224 R1 I, f7 n  c' v# d/ |) [2 ]
  59. #define ITCCHEN_SHIFT               235 ^7 D2 J: g: k

  60. 8 ]9 G5 |0 B- K* _
  61. static volatile int irqraised1 = 0;
      Q; M+ [- d# S
  62. static volatile int irqraised2 = 0;
    - O, d: b1 l) q' U& b0 f" ~/ n! G7 I
  63. & L# Y/ |) T$ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 R  `; P( h' c8 e, u" h# i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , q8 z9 B' Z/ a# n* Q5 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. `+ Z' I  ~6 D5 j9 m5 A
  67. 6 a/ g( W! G- I, u8 `5 [9 D* y
  68. dma_addr_t dmaphyssrc1 = 0;8 p2 F* [, P: ^2 e2 Y$ T
  69. dma_addr_t dmaphyssrc2 = 0;
    5 R7 J( P& |. {9 U) Q6 o
  70. dma_addr_t dmaphysdest1 = 0;0 j' h7 j6 T0 I
  71. dma_addr_t dmaphysdest2 = 0;0 K! t+ q& V  G. p) z8 d

  72.   i2 @/ V6 p8 n4 h* G8 C6 X/ m
  73. char *dmabufsrc1 = NULL;) W) `9 J5 Y* L7 z
  74. char *dmabufsrc2 = NULL;( u! `+ @, d1 Y% c
  75. char *dmabufdest1 = NULL;
    / }' O% r! ^( f' ~2 c
  76. char *dmabufdest2 = NULL;- m5 {, B  _7 b" K# i" O6 o8 e
  77. 7 ~! G( C4 ?( w7 i3 b
  78. static int acnt = 512;
      K0 C0 l* k1 i! l% g
  79. static int bcnt = 8;
    # O3 K1 l/ Z# H/ C* E+ Q
  80. static int ccnt = 8;
    5 p6 f& N  }. k. x

  81. " {7 k5 k, N9 |/ P- A0 ?
  82. module_param(acnt, int, S_IRUGO);
    - v+ J" @/ N; F3 m
  83. module_param(bcnt, int, S_IRUGO);6 i5 \3 C7 A" W9 d: D( X( k* b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: o5 N/ ~3 j. T. V5 U
5 \: X/ n" I- s7 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Z' C7 `) H0 V; Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 I' m1 R4 y2 b& N2 W8 `2 s, V+ @8 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 z: o3 A. g" Z0 k7 ?8 m5 k4 ^) R# u' v# X9 X+ t
- _8 O9 v) z9 ~" f# c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-29 06:15 , Processed in 0.046891 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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