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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 P0 {, L( K: O( ?( q( q
  1. [code]EDMA sample test application
    + T3 ^  ], S, r8 u% n% C# U9 N
  2. /*& i1 x# Z2 X- t* J0 Q
  3. * edma_test.c
    $ \9 p" P6 ]: t1 l# {+ e
  4. *8 f( w; t% l, c
  5. * brief  EDMA3 Test Application0 i- W" Q5 t  j& f0 i. ?
  6. *! ~* T! T) o8 b' e9 _" G
  7. *   This file contains EDMA3 Test code.
    " i0 d! |4 y8 H. g* v$ [
  8. *
    & @( K& ^9 x8 [, e. s8 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! \, p* i. B& j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! J- e  a( N. U- F9 S! P
  11. *         TO CHANGE.6 D1 ~; y8 Q  i! j
  12. *# @3 Q* Y: p. ?8 |" w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ z5 S' n/ O( y) B0 a% \
  14. *
    ( V# C' |) R8 z& J3 }. v8 r: U: N
  15. * This program is free software; you can redistribute it and/or
    / h2 z( ?9 l+ Y
  16. * modify it under the terms of the GNU General Public License as3 R! d: h  J$ G" ^$ T8 e) u
  17. * published by the Free Software Foundation version 2.
    + N7 N* B) J; v8 Z# j% m
  18. *! e4 m# V) d) z7 n7 L  c. d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 U* G; W! A$ U( V1 C$ Z2 Z
  20. * kind, whether express or implied; without even the implied warranty
    6 l6 r4 D8 Y4 |: i4 {$ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Y* ]* X) q  C
  22. * GNU General Public License for more details.
      j0 Q% q' o! p% I5 u; t
  23. */
    - d& N7 b  |) n/ S3 `8 {
  24. - Z# P, c& g7 s/ n$ v
  25. #include <linux/module.h>
    5 z5 Q7 r9 u) @9 N, o
  26. #include <linux/init.h>
    # U+ i  j8 D& B6 d$ O0 j; g. ?
  27. #include <linux/errno.h>. m/ y8 A- V+ J$ n9 C% E
  28. #include <linux/types.h>! C' f) e: I4 r: W) R  N( N
  29. #include <linux/interrupt.h>
    / k5 l6 B- _5 k- v8 G9 ~7 m
  30. #include <asm/io.h>% J5 R) u, a0 ?- i! r: w6 K' [
  31. #include <linux/moduleparam.h>
    ' C1 [1 q3 V: u9 d7 Q& ~* @* ]0 |
  32. #include <linux/sysctl.h>5 }# w& O- `4 d! V) g
  33. #include <linux/mm.h>- a8 ?& S3 U! f) X
  34. #include <linux/dma-mapping.h>) \$ e1 c3 F# A2 r' L6 B4 K' W

  35. . ?  ?4 R; q. ?
  36. #include <mach/memory.h>& N8 X8 P2 t7 W/ G! L2 Y2 P' o1 R. a
  37. #include <mach/hardware.h>
    : j1 B) b' d) ?: M2 {3 r8 t& Y; U
  38. #include <mach/irqs.h>! u0 `& f* v2 {+ C, M! N9 Z
  39. #include <asm/hardware/edma.h>, \/ I, ?5 Q  ]% R( \

  40. : Q' Y% _% O* J7 D3 A
  41. #undef EDMA3_DEBUG4 U. P/ {. i, Z+ V7 S
  42. /*#define EDMA3_DEBUG*/
    % A& D5 R6 E7 v, p# q2 s

  43. : y9 j7 q+ v9 B/ m* Y0 e, q
  44. #ifdef EDMA3_DEBUG
      x5 ], t3 i5 z  O2 }9 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 X- b/ w. q$ H% O; G. S; E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ t. ?5 i& K* N1 D: j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 a7 @1 ~* y; l
  48. #else3 N* F( C  q1 K9 t# v' W
  49. #define DMA_PRINTK( x... )
    7 i+ `5 [  M% c  o6 Q
  50. #define DMA_FN_IN% ]- w5 e: S+ x. Z8 G% _/ ]
  51. #define DMA_FN_OUT
    7 p) s  Q) S% g$ A0 C4 d
  52. #endif/ w& Q; d- }! @
  53. / a1 J* D* K# P9 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 M# {3 ^0 L- M8 [8 l4 Q- e1 w& K; |
  55. #define STATIC_SHIFT                3
    1 m9 t( f+ d' e5 K& H8 K  N
  56. #define TCINTEN_SHIFT               20
    3 e: n5 h$ s" E. {
  57. #define ITCINTEN_SHIFT              21
    , M8 D. ]" b9 m8 f! F8 O4 D
  58. #define TCCHEN_SHIFT                22
    - o1 N# L! k& a" P+ X) b
  59. #define ITCCHEN_SHIFT               23
    1 b' n' x) {1 U2 x. `6 y
  60. ; n( K* ]: H3 D+ f
  61. static volatile int irqraised1 = 0;) p- s1 h7 E& r* [
  62. static volatile int irqraised2 = 0;7 c+ I5 n1 U5 ?/ F$ Y9 m7 T

  63. ( }+ D% @8 v5 y1 c. a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' l( S0 x5 a$ u9 f$ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( k: I* P# L, r5 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _  `6 g8 g* o, q! |! K7 q

  67. - D# O$ j7 q! z( x
  68. dma_addr_t dmaphyssrc1 = 0;
    % X9 K3 D/ P" V& P# [) E
  69. dma_addr_t dmaphyssrc2 = 0;6 X6 M; r& Y' K
  70. dma_addr_t dmaphysdest1 = 0;. W! E9 m5 t( l% b3 Z
  71. dma_addr_t dmaphysdest2 = 0;( R; h/ h3 ~' l! N* o- n
  72. $ ~( e' W- }) C3 W$ T8 `
  73. char *dmabufsrc1 = NULL;
    ' T' t3 x) r" V, ~
  74. char *dmabufsrc2 = NULL;. w% A# O, R6 x% r
  75. char *dmabufdest1 = NULL;% y  M4 q& B' q! j- G, g
  76. char *dmabufdest2 = NULL;' ^/ E1 i; L5 U& `8 @7 @

  77. # Q1 V. |  v/ p9 t& l. e
  78. static int acnt = 512;
    3 A# ^, S2 l) o
  79. static int bcnt = 8;; V" d3 s# G0 T6 P1 K
  80. static int ccnt = 8;+ a2 f" J8 B& p* O1 H
  81. 7 N5 y( j$ B: F: |# |0 M
  82. module_param(acnt, int, S_IRUGO);7 g, h" w# n+ n( g; p
  83. module_param(bcnt, int, S_IRUGO);
    & E9 o) U+ H6 R& K9 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& v8 H+ o: g# V1 e' F

  k2 b" K6 t5 N7 L) N2 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X* O9 Z* b% ?! H0 y
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 C+ R9 S* e7 T0 \7 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ^0 q5 ?5 B6 E& U
: Q$ D, r, V( H  [. {
& U# P0 r. \4 d! v1 z# f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 05:13 , Processed in 0.040257 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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