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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ @( A8 C" ~$ E: c* a1 t( ]
  1. [code]EDMA sample test application# K7 y- y& |7 P8 U5 T
  2. /*- X1 C! R; ~9 e5 ~: J0 F9 L' Y
  3. * edma_test.c+ K/ s4 h  D1 A8 _
  4. *
    ) A! r. t+ p, F# q1 C' t
  5. * brief  EDMA3 Test Application. O* j; j1 a  [& r6 i/ [
  6. *. X6 }/ l  N% x9 i, q4 k
  7. *   This file contains EDMA3 Test code.6 b( H9 |8 _$ |  I3 @9 g" a1 ~6 {+ Z
  8. *  I- O' j9 W0 y. c2 C, O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 R) R: q& z  I( Y- k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 m% g, Y6 q1 F/ W% n4 H& ?
  11. *         TO CHANGE.5 T6 O! A+ l5 V6 l
  12. *0 D. V' ]) K: b7 h4 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# c% u8 L0 ?4 B! {4 C
  14. *
    , J5 O) R4 D: z2 P1 T
  15. * This program is free software; you can redistribute it and/or
    ! D+ u( A) [- U- U! v7 M4 e$ a+ ]9 p
  16. * modify it under the terms of the GNU General Public License as
    3 y' D& J: m5 ]; ~' L. B
  17. * published by the Free Software Foundation version 2.
    # |' r! X8 l  R1 _( r( b8 z" `" m
  18. *( K; L: ~) R( c* p9 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 s5 K' L+ w. u2 [7 h
  20. * kind, whether express or implied; without even the implied warranty$ y; b7 z6 g! J+ b$ a) T7 B: `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ q7 o/ j1 o$ a! {6 R2 r* o
  22. * GNU General Public License for more details.- x! U8 ?# u3 U, E1 N2 ~
  23. */! H0 E8 ]! b6 p$ [- P$ O
  24. : ]; w1 X" r' F  _# Z
  25. #include <linux/module.h>
    * ]/ @0 l- S8 I. g9 z0 n: N
  26. #include <linux/init.h>
    - S1 Y6 z/ a2 f( g" ^: A0 C! F. N+ }
  27. #include <linux/errno.h>  h( T1 v3 \, I& Z% E
  28. #include <linux/types.h>0 Q& {/ ^/ h( v8 W8 _+ ]
  29. #include <linux/interrupt.h>
    # }4 X$ P* `5 H2 D- Y# o1 O
  30. #include <asm/io.h>
    - C1 T& U" w  W1 }& O
  31. #include <linux/moduleparam.h>& u# S' V( a1 g6 r" x1 K4 E
  32. #include <linux/sysctl.h>* n- ]9 P0 b  l' X2 w
  33. #include <linux/mm.h>8 J6 f( w; u, D2 o9 A
  34. #include <linux/dma-mapping.h>
    ( h2 q5 E, {* u. v& ?4 ^/ ^

  35. : ^4 H, S7 Y# a0 g" z
  36. #include <mach/memory.h>
    0 Q8 H! Q6 t6 v+ l% B3 s
  37. #include <mach/hardware.h>
    5 N7 y  m" ^/ h2 N
  38. #include <mach/irqs.h>( g! R5 V8 {( K+ L' T. O4 z, D
  39. #include <asm/hardware/edma.h>8 S3 n; C" d0 S- q; f

  40. ( M0 J8 u$ B) J9 Q  l, u! h  S
  41. #undef EDMA3_DEBUG
    3 j+ K& e( X) P
  42. /*#define EDMA3_DEBUG*/
    2 J# F$ k1 d- c, f& |

  43. 4 c; p2 n+ ]" n# {
  44. #ifdef EDMA3_DEBUG/ t/ J- X3 J; ?% Q6 a* H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 d) m# M& U! L- _" Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' A1 v9 h2 d9 W. K: v4 D7 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 n8 M8 w& A6 b
  48. #else
    5 F3 O, F% C4 ^% u4 u. y$ p
  49. #define DMA_PRINTK( x... )
    # J. X$ s! O: a: p7 F
  50. #define DMA_FN_IN
    3 B: |( s" P5 i8 j* F
  51. #define DMA_FN_OUT
    " k1 o) m% o) `% i8 Q5 x- c
  52. #endif
    ) z$ u5 \- s& [/ b

  53. ! b# i8 j1 N' |1 K, A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 [6 b4 m/ t* ~8 f5 P5 p1 S
  55. #define STATIC_SHIFT                3
    2 k1 f1 D1 ?6 ]
  56. #define TCINTEN_SHIFT               20
    8 m. ^3 Z$ [  J" V4 @* N1 T
  57. #define ITCINTEN_SHIFT              21
    " M% t3 r. R8 r* q6 y
  58. #define TCCHEN_SHIFT                22
    5 n6 N; E% t7 A+ M) G
  59. #define ITCCHEN_SHIFT               23/ a9 J7 L$ y) {; R+ N

  60. 0 q) q/ S( y+ @3 j+ \
  61. static volatile int irqraised1 = 0;- G% K0 G5 F& X# r# p: Q- T
  62. static volatile int irqraised2 = 0;
    , L5 Z  M: `: x# u

  63. 7 _! ~, b! v6 w8 a, A- U$ ^4 f0 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 @% W0 h4 R8 k% F* c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 f- t9 E: X3 j4 l5 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ^+ \5 X% K; q& A) a' e& c% a& Q

  67. # Q0 U+ [  \; N+ m/ G, s$ r
  68. dma_addr_t dmaphyssrc1 = 0;1 u( A3 l; M, @' p
  69. dma_addr_t dmaphyssrc2 = 0;
    2 ^8 @( G4 H. r/ L/ d: S
  70. dma_addr_t dmaphysdest1 = 0;" i1 l+ {! B: Z0 o: W
  71. dma_addr_t dmaphysdest2 = 0;
    6 [8 u! V: r$ ~! B' N
  72. ; ^' ]; c6 H. R) ~% j
  73. char *dmabufsrc1 = NULL;0 [  M: l) z: P, m
  74. char *dmabufsrc2 = NULL;
    ; X( Q! |8 F5 e/ {, Q/ P
  75. char *dmabufdest1 = NULL;; u7 ?* T7 s- e: N
  76. char *dmabufdest2 = NULL;3 @: R/ a; ~3 ^) G, O
  77. 5 f4 n9 S7 J% j! R- x) p# Y
  78. static int acnt = 512;' z- N% `, e: m" w. e
  79. static int bcnt = 8;4 f8 ~  F9 G8 |
  80. static int ccnt = 8;3 w+ ?. U% j$ B1 \
  81. & e) E* @& o! G; x- T% o! P9 _2 M5 f
  82. module_param(acnt, int, S_IRUGO);, |1 ]2 v4 g$ S9 ]9 X# S3 ]
  83. module_param(bcnt, int, S_IRUGO);+ y6 n& s# {: M/ n; b# u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 c2 m  U; C% h. |, N8 F: |( U& Y1 M0 [$ V2 M+ \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ |/ ~$ C$ {7 J" m. {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 L3 i. i4 r. f  k; q$ ?) j- @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 k. Q: n! @/ P3 W
' X) G3 M: w+ ?/ W4 c' a4 T

- k4 E* d( e" `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 15:14 , Processed in 0.057983 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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