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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   c0 Z( J4 U! ]; K4 ?" ]- V
  1. [code]EDMA sample test application* A; j0 P( h5 i2 O. n. w2 z/ P  d0 {
  2. /*
    3 X: V2 O1 D, g9 O/ [
  3. * edma_test.c
    7 i! P  p2 S/ i6 s0 ~/ e
  4. *; H8 F( B$ a/ M6 b1 {
  5. * brief  EDMA3 Test Application4 D* T/ }0 s9 n" N9 v
  6. *+ d- c  B3 @2 v. _( ^- h+ r2 ]
  7. *   This file contains EDMA3 Test code.0 |9 H/ t5 q; s" }& w; [
  8. *: C/ c1 a3 p% }; C. z0 V5 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : M% I6 @' s3 V& n+ a1 S) k6 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 T4 P% n' ?5 ^  a0 z8 U/ x
  11. *         TO CHANGE.
    ) c! A" C; r4 N8 {
  12. *6 J1 e4 O5 r% W5 c' Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* T3 J- G: i  K: Y9 A3 f- ^7 S
  14. *
    + Y5 o# w8 e! [* c# F2 O6 P
  15. * This program is free software; you can redistribute it and/or& ^  ?: H- @' A- p
  16. * modify it under the terms of the GNU General Public License as4 k$ F3 [( X8 [# e4 [
  17. * published by the Free Software Foundation version 2.- o/ k: D( o' T/ K1 S
  18. ** t1 G" _; B0 {; g6 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 d* k! _( U4 i/ b5 K
  20. * kind, whether express or implied; without even the implied warranty
    4 D- N9 P6 i' M1 q, }8 o, j9 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) {/ F) K$ }# q7 N/ O* }! \
  22. * GNU General Public License for more details.
    % M5 t7 A1 X% {+ n, Z; M
  23. */
    6 y3 l+ A6 r+ d6 C
  24. : W1 a" d3 m- k+ y8 l' g( J7 g
  25. #include <linux/module.h>
    - J  L0 ~0 a( `/ c' P( g
  26. #include <linux/init.h>3 [" ~& N$ O! b, m# c) T
  27. #include <linux/errno.h>0 ~6 y" {1 x; q  G" h7 U8 ^( q* L8 P
  28. #include <linux/types.h>* ~* V0 N. |8 F) F( k5 j
  29. #include <linux/interrupt.h>
      u* W; _: H  q/ i
  30. #include <asm/io.h>2 L+ a/ B/ g1 l; U9 F
  31. #include <linux/moduleparam.h>4 u4 g# g- o: ^5 K- `
  32. #include <linux/sysctl.h>8 [+ ]- f2 S' [( D! t! o! E3 u
  33. #include <linux/mm.h>
    ! @7 l' H& c9 u; O  J( J7 k0 M# N
  34. #include <linux/dma-mapping.h>: P! i" ^, p$ F! y

  35. 3 p5 A4 G/ m6 ]  j+ j1 s1 z
  36. #include <mach/memory.h>
    / W; Y7 q3 a# M$ o. `; _: E
  37. #include <mach/hardware.h>
    ; W( l, h' \- Q, K2 H: E
  38. #include <mach/irqs.h>
    8 T& x3 C" \4 Q7 D, m% n
  39. #include <asm/hardware/edma.h>- I, a( S/ {9 W

  40. ' A( {5 f  w- p! {  N8 W
  41. #undef EDMA3_DEBUG
    . Y1 E) x( l7 o! }+ V
  42. /*#define EDMA3_DEBUG*/
    / F7 u: G; `+ H2 h# f

  43. ( B. V/ ~* w- i. G3 n
  44. #ifdef EDMA3_DEBUG
    0 d8 I( T# h- o* P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( T2 L9 C$ i! \/ a/ m- [% S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' `# g2 p% S: e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , J( R; j( l  Y7 _3 J2 u7 R
  48. #else' u4 B1 X4 @5 L3 I
  49. #define DMA_PRINTK( x... )* L# V% w6 j8 S
  50. #define DMA_FN_IN
    $ u4 I  X/ _/ q# g9 Z
  51. #define DMA_FN_OUT
    ( `$ g- Y+ f" M+ y" S
  52. #endif5 m# [) Q; m$ C3 Q
  53. . U, C& `0 |+ _. S! U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 [# x2 R8 X3 |7 Z2 r8 t
  55. #define STATIC_SHIFT                3. }; m# y. D$ \# ^2 ?
  56. #define TCINTEN_SHIFT               203 D: P- I. W# o5 y/ x
  57. #define ITCINTEN_SHIFT              21
    ! e2 G0 K& Y- \  ?9 t5 H# F
  58. #define TCCHEN_SHIFT                22" Z6 @$ C5 N4 v- i
  59. #define ITCCHEN_SHIFT               239 j9 I5 B* i  ]$ W/ ]$ h
  60. ) F3 B$ ?. \" Z6 U( L
  61. static volatile int irqraised1 = 0;
    * a/ c8 S7 ~2 X- i9 \' q
  62. static volatile int irqraised2 = 0;# ]. H" B; \) F% C7 Q! S) m! Z  u5 _

  63. ) Z- w' H4 a+ U( t, V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 h+ a% S2 R  }' p) v) @; j* _" O+ u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - t! o) x4 h2 [  F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : b3 N  F/ d  p+ T

  67. % R3 e5 E' R) n; x9 x, o
  68. dma_addr_t dmaphyssrc1 = 0;9 }. d' U" b- g
  69. dma_addr_t dmaphyssrc2 = 0;* j& ]# A$ j- F' V3 P/ _+ m
  70. dma_addr_t dmaphysdest1 = 0;9 m9 X" }8 T- ^. X5 c4 d7 L9 l
  71. dma_addr_t dmaphysdest2 = 0;
    : e8 ~. d' K. k) b$ K, T* r! h

  72. 9 H5 a/ Z' t& P8 w( L/ R/ e
  73. char *dmabufsrc1 = NULL;7 Z' e. v3 Z1 n* ]0 a4 f3 J
  74. char *dmabufsrc2 = NULL;$ ~9 f) M: u# D+ D- P5 X% j
  75. char *dmabufdest1 = NULL;
    & {" |9 M4 _/ P) Q7 S
  76. char *dmabufdest2 = NULL;, F( X' q- J- j1 e( D5 x
  77. 5 b  B. `% o9 `/ N, ]) d! W+ F  d2 z
  78. static int acnt = 512;1 r% i/ X4 G; e$ @) r' r; \3 W
  79. static int bcnt = 8;
    " ^% X. T8 j, M; T7 a. w( c
  80. static int ccnt = 8;
    / Z+ D: a. r5 w+ C* \$ ]
  81. + G# p# F& S2 V5 a; Q
  82. module_param(acnt, int, S_IRUGO);" D( [* F; U/ y
  83. module_param(bcnt, int, S_IRUGO);5 J( ^' t5 I, R& H7 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  o: U6 ]* |) i" Z8 O' r5 l1 ^
- b. `7 q. W- d) I$ `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 D* v8 B; Q9 H9 A8 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) F: b6 |- F/ F& k/ m6 J! ^) K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- _" T* f5 O- m& q5 \1 t3 z) c8 l2 s. {+ x

2 s: Y  K# x; g, Y- O* D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 05:07 , Processed in 0.040108 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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