OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  R5 i$ }$ U9 [$ H$ v
  1. [code]EDMA sample test application
    8 g- R/ ]4 R- p6 c1 G
  2. /*
    2 T. X+ x# o% T
  3. * edma_test.c) E" g/ ^* t% ]; K( f: K
  4. *( r/ s, f6 _: M# o
  5. * brief  EDMA3 Test Application6 M. i. k$ i6 ^$ `* L5 i# F9 p
  6. *2 F  D; R, E1 P5 c; |
  7. *   This file contains EDMA3 Test code.
    : f$ e8 F" E/ y' j
  8. *- c$ S) n+ t0 `, \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + W, }7 ?, v# N9 T' v" ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 F, |: z% M- v, C. P# ^
  11. *         TO CHANGE.7 D0 g7 S. b8 S/ [* z* R; l
  12. *
    1 t4 g8 ]4 \3 f# L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" z" `9 M5 R* h" F& N  \0 Q% _
  14. *% [/ N% F5 `. h. O$ I1 w7 u
  15. * This program is free software; you can redistribute it and/or
    7 E* r! ]8 U* ]/ N
  16. * modify it under the terms of the GNU General Public License as
    7 D* T( ^3 J: l+ R
  17. * published by the Free Software Foundation version 2.' v# t/ ~( s7 L) i
  18. *
    , `0 v% u+ }0 n9 a9 Z7 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 C- U, z7 Y% W( n
  20. * kind, whether express or implied; without even the implied warranty& ^6 j* |" U; i  l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  I5 x' B( Q5 z1 ~4 ?# W
  22. * GNU General Public License for more details.
    2 s. L; f* c9 S% Z* N: K7 v/ O
  23. */& x9 A/ \2 X- \# A) m7 }5 T
  24. 9 H& Q0 w  F8 l: }; w
  25. #include <linux/module.h>
    & |4 a4 }7 W) X' W0 q
  26. #include <linux/init.h>
    ! b% c0 x+ u" u7 I; z5 U
  27. #include <linux/errno.h>- R# N0 X* Z4 z& U! n! U. o6 }
  28. #include <linux/types.h>$ t( i$ Z! |; {; v$ k! I% }7 C0 j
  29. #include <linux/interrupt.h>
    : {6 I9 o; K" q5 ?" w3 L- L* V
  30. #include <asm/io.h>
    % S1 W0 @4 I. M8 x: O$ L/ l
  31. #include <linux/moduleparam.h>
    , _  d( F7 B& P1 W: W
  32. #include <linux/sysctl.h>
    4 X( S, i- P9 M% U/ l( [
  33. #include <linux/mm.h>" s) f7 L2 x$ C' @, ]# D( i' B- y/ X
  34. #include <linux/dma-mapping.h>
    2 E( N/ j! L3 @% G0 {
  35. ! }5 H( R6 D/ n* e8 V7 e0 W4 ~
  36. #include <mach/memory.h>' f' g$ T* h! |: b
  37. #include <mach/hardware.h>( U' d; f6 \' U1 ~, b1 p8 b$ F
  38. #include <mach/irqs.h>: ^+ B+ c8 }, p# c
  39. #include <asm/hardware/edma.h>
    6 a6 x- V* y( K
  40. . V* B; j* ?8 r2 R# X
  41. #undef EDMA3_DEBUG0 ^- }4 B! q: l1 L5 Z
  42. /*#define EDMA3_DEBUG*/: S5 ~2 ^8 v$ A" p8 J

  43. 3 z6 Z% C, r! S1 |# B, p
  44. #ifdef EDMA3_DEBUG: |) f+ U+ M. V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 h4 y$ @: k3 Z6 X2 F& \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " d2 J0 f& g& q% u* _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + L- p1 E: M+ U2 W$ }/ e9 m
  48. #else3 K" A: K4 s3 j4 _. Y
  49. #define DMA_PRINTK( x... )
    & z6 ?2 F; C" B
  50. #define DMA_FN_IN: y: z6 Y7 _9 Q7 \6 _
  51. #define DMA_FN_OUT
    9 g; e) m6 V% U: y  Y) z
  52. #endif* q0 {- Y% M. o% P* M  x" h

  53. / n1 |4 F( u- t, G% Y$ s# l# E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! }4 o7 M5 J0 x& M
  55. #define STATIC_SHIFT                39 F0 y+ K: e5 o5 t+ o% E/ K
  56. #define TCINTEN_SHIFT               20  T: j9 B9 e* ~7 }/ q5 s0 p
  57. #define ITCINTEN_SHIFT              21
    2 I+ }$ n" I/ w" l
  58. #define TCCHEN_SHIFT                221 j6 z* g' Q$ t6 E6 c0 M5 n
  59. #define ITCCHEN_SHIFT               23
    3 ]8 A7 t- ]+ F) |; J( E
  60. / `, v$ V' Y5 C$ z
  61. static volatile int irqraised1 = 0;' x- Q; P1 `6 a; Y
  62. static volatile int irqraised2 = 0;
    8 z' k) {; ]4 x5 W, x7 P6 z. U) F) k" W

  63. 8 p; r7 d/ C- z1 D+ K: `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , C# ?& W+ d1 O/ E! Z0 U# }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 e) R$ w  b  U. _1 I! B+ @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 k* e4 e1 w& E  I: D
  67. ; m, b9 f8 C+ a
  68. dma_addr_t dmaphyssrc1 = 0;
    ( K& \& b3 G4 `: l/ o! M- A- q* r
  69. dma_addr_t dmaphyssrc2 = 0;
    1 h3 D# b' S; ~% S6 G# N
  70. dma_addr_t dmaphysdest1 = 0;- ?* U, m( G& u6 C: V) ^2 o5 H
  71. dma_addr_t dmaphysdest2 = 0;5 D# U4 `! e7 j) C) P' X0 d
  72. ! V9 a/ C* P9 v$ m
  73. char *dmabufsrc1 = NULL;( v. q: e, t  B: \1 N+ J
  74. char *dmabufsrc2 = NULL;
    2 J0 B% E' R8 m' B1 A4 {; v
  75. char *dmabufdest1 = NULL;
    " H8 |; D) x* h5 @1 A
  76. char *dmabufdest2 = NULL;
    . H6 r3 l1 J' f. K

  77. . a+ t% ?& z0 @9 N% b6 s! @
  78. static int acnt = 512;
    ; Z9 S) O9 q) T  u
  79. static int bcnt = 8;
    1 @7 z; V, H/ x2 W  f* S- V
  80. static int ccnt = 8;
    * g8 h0 k) ]: L

  81. $ ~: R" B! I4 s' T5 P
  82. module_param(acnt, int, S_IRUGO);
    . r# n( \3 V9 Q
  83. module_param(bcnt, int, S_IRUGO);) \& D8 u- M) b( ?' N6 q  M- S# Z" [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 C+ _% j# }; g. |
, O/ D7 ?4 `+ v; z' m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ]  H7 j2 d% C+ r- G: U, D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 [1 n( A# l+ I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ q9 h- m# F4 a/ c5 c! n9 b( b& V- [( G! |7 {7 @, B
* L6 L, O$ X( n- H4 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 17:43 , Processed in 0.038856 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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