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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d6 O8 b; p  C  C, V. ]
  1. [code]EDMA sample test application: r  X+ Q; S$ V+ Y1 `
  2. /*
    1 q& N9 m1 z+ n
  3. * edma_test.c4 q- J4 ~$ D( @4 l5 u( C7 Z# G
  4. *! T/ a% H+ o; z* A
  5. * brief  EDMA3 Test Application
    - O& C: c* c8 B5 C5 e* z
  6. *, i$ I. S3 _# s6 U; _8 _
  7. *   This file contains EDMA3 Test code.: n- W# Q1 E3 W& w/ g
  8. *
    5 C4 _/ b+ H2 U. N- d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ~4 r+ r/ e. E* v9 x$ C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 o$ [+ B# Y/ [5 f8 Y8 F
  11. *         TO CHANGE./ _! T& P$ Y1 ~  {
  12. *
    / Q1 d7 X& h( r: M  }$ s( e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. I2 k0 S+ g3 S! W; I! f
  14. *
    ( u4 r9 t- X: ?$ Z. a
  15. * This program is free software; you can redistribute it and/or
    4 g# W2 m* ~  g( j8 ]  Y6 G
  16. * modify it under the terms of the GNU General Public License as
    9 _5 S; i, Z4 R+ B* d
  17. * published by the Free Software Foundation version 2.% S" [! N3 y: `! {
  18. *# Q# p0 ?$ n+ k, q/ G7 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ?" T2 D' g! f
  20. * kind, whether express or implied; without even the implied warranty
      j. g) [4 s; l1 `5 a1 }4 U2 i- y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" _  h( ]# a. g$ `) Y
  22. * GNU General Public License for more details.
    6 Q: Q& o  |  N2 v3 s& S
  23. */
    " ^5 x) z  A" `; r$ C; O( n

  24. + N: K; f* Z0 c2 A" k9 O
  25. #include <linux/module.h>( h0 C9 i/ ^, E, a! k" N
  26. #include <linux/init.h>
    ( e4 x% J! g3 j3 v8 q  Q# A
  27. #include <linux/errno.h>
    # Q' C4 |* W: O* C  k0 f8 D# \1 R
  28. #include <linux/types.h>2 `- ^0 J: m  o; \+ y2 P
  29. #include <linux/interrupt.h>
    : P# q* ~1 `% I) a( u8 v
  30. #include <asm/io.h>
    . \) r0 V$ P! h
  31. #include <linux/moduleparam.h>
    - N1 J' u( c( B7 B# D& h! N( K' `
  32. #include <linux/sysctl.h>6 l- a: u' x3 t  u, y; W. L
  33. #include <linux/mm.h>5 p5 n6 v- C  r3 ^2 f- I: h+ A
  34. #include <linux/dma-mapping.h>, W- P( A0 J) H6 {5 Z) z- }- `
  35. ' p9 f2 d+ G0 t. g& V
  36. #include <mach/memory.h>
    ) |- ~) r5 j) {$ h+ ]5 {
  37. #include <mach/hardware.h>
    7 `2 c. \, ~: [; M, g
  38. #include <mach/irqs.h>
    ( j, T2 \  J  L/ o/ U- f' J) j
  39. #include <asm/hardware/edma.h>
    * k% t' x) b. X2 {* ~
  40. 3 Q% L+ G. n! B0 }5 l
  41. #undef EDMA3_DEBUG
    ( Z4 K5 ]/ {( X9 h- C$ n9 X
  42. /*#define EDMA3_DEBUG*/
    + o* E# _" e! j( f% n# r2 i
  43. + ^7 S" V+ L7 F$ h/ i1 z
  44. #ifdef EDMA3_DEBUG
    / u, C  b; r6 ^! O. r) }) G: ?/ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 |* M+ v/ s( [8 A" W3 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! _( q% g2 h) {; [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % k3 x7 f5 P; L+ q
  48. #else+ M. o7 k; Z5 S" B
  49. #define DMA_PRINTK( x... )1 v) E  Y$ t6 S: m7 C
  50. #define DMA_FN_IN
    9 C5 D& a' Q- g  Q+ t
  51. #define DMA_FN_OUT
    & a* j! M9 a- R+ g3 H; Y% m9 X
  52. #endif
    2 @# j  U! [- o
  53. " n8 w5 w' W, [3 r* G" s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) ~0 K. o- Y+ E3 Z
  55. #define STATIC_SHIFT                3
    $ ~6 F; A+ H8 g, C
  56. #define TCINTEN_SHIFT               202 e+ e+ d+ Y' k' W/ J" ]3 M
  57. #define ITCINTEN_SHIFT              217 e' t5 M( C" g2 C
  58. #define TCCHEN_SHIFT                224 l/ q0 C3 f( r
  59. #define ITCCHEN_SHIFT               23
    ( n* D) w: T  ?2 `+ U

  60.   r3 D9 w+ h; \! O
  61. static volatile int irqraised1 = 0;
    ( ]% }; |- v# ^! }; ?5 G; k1 h( \
  62. static volatile int irqraised2 = 0;
    / T+ c) P3 r0 j4 b  i
  63. 0 \) O* V' E! ]7 y6 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 J+ z' X' l' _( t5 |& i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  o: b3 ~0 T( P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 W& R8 q' x) }: x4 a( m
  67. & `# H3 @! V8 U  A
  68. dma_addr_t dmaphyssrc1 = 0;
    * ^- J# A- |9 A- ]+ N+ O9 K& M( J
  69. dma_addr_t dmaphyssrc2 = 0;
    9 l  [+ Z4 W  q1 k3 D9 G  R) u
  70. dma_addr_t dmaphysdest1 = 0;9 |2 j5 u6 N0 [4 m% V
  71. dma_addr_t dmaphysdest2 = 0;
    * D( f/ F$ ~3 `9 k' X) S

  72. . [, p, J/ e+ ?
  73. char *dmabufsrc1 = NULL;
    ' w0 {2 `8 p3 u# B3 K+ s; |
  74. char *dmabufsrc2 = NULL;
    8 i2 C1 u  |/ w0 a5 u8 x- y4 G
  75. char *dmabufdest1 = NULL;
    . h8 L* ^9 H' a/ B
  76. char *dmabufdest2 = NULL;9 b* v4 H$ Y0 ]9 x

  77.   L/ f' k0 ^$ {
  78. static int acnt = 512;
      p8 e8 R% D: w7 U2 b. t$ |0 W5 ^
  79. static int bcnt = 8;/ l0 L. C4 |/ h! g
  80. static int ccnt = 8;
    7 m- w2 R/ U: X
  81. ' S( v8 m7 H" ^$ Y4 ]9 O: t
  82. module_param(acnt, int, S_IRUGO);
    / Q5 X3 C8 o) z7 t
  83. module_param(bcnt, int, S_IRUGO);
      N' ~) O6 j" W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; S( @9 ]* o) U: b  W& _
  |: v- B6 b, Y0 y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. I8 E7 ?+ H3 }9 f8 U; T' Xarm-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 S; I# k. f6 r; H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: f/ X; D& {! C1 |4 N7 A* Q# X. X

& j7 ~/ `1 {. D; T4 h3 `3 {" n  j  u: X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 18:45 , Processed in 0.038928 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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