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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # p, w0 L5 R1 o9 s1 \0 R
  1. [code]EDMA sample test application' ?! p' ^, t  s& d% T# G
  2. /*4 V# ^' o$ l1 m8 G
  3. * edma_test.c2 F0 N0 v; ]$ N( q) q6 I  l
  4. *
    # u% B2 d8 J  B
  5. * brief  EDMA3 Test Application! Q7 K' {: l- }3 j$ x% X. B
  6. *% {9 I/ Z+ r* y3 T# Y
  7. *   This file contains EDMA3 Test code.- L( B7 J4 ]5 _" d/ q* G) ?# `! [  y
  8. *% _; U9 {+ M% ~( d" G; t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ A1 y+ @1 t* Y' W3 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! d3 z0 k) M4 O
  11. *         TO CHANGE.+ @; \6 ~1 x. o- E% @" J
  12. *
    7 P: ]/ R8 s( E6 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* h+ m8 T+ N8 a) @( y
  14. *3 M- R5 o, V+ p, s7 D4 f4 s% P
  15. * This program is free software; you can redistribute it and/or
    9 A; n8 C$ f9 _  w( F
  16. * modify it under the terms of the GNU General Public License as% k0 S5 d8 P+ V
  17. * published by the Free Software Foundation version 2.
    3 f4 T( W0 j  T. X( r! w# X. K
  18. *: Z6 b4 I1 p+ @7 t: M( p$ ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) i1 p8 M, @+ j& n' ?, _
  20. * kind, whether express or implied; without even the implied warranty
    . }* q# I( i9 N$ i; N& i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: G0 Z9 S# z- [; b
  22. * GNU General Public License for more details./ n1 m9 V( a  B, C. m) C6 {
  23. */: O1 V- u: E' V; u6 \6 l& }. [
  24. ) N0 P, Z2 e" y0 k, s8 M
  25. #include <linux/module.h>
    4 s" B1 K" E* o% U
  26. #include <linux/init.h>6 |8 A( A, P* E0 p1 d% h1 J  `
  27. #include <linux/errno.h>
    6 S; Y* ?# v1 k6 t: h& W
  28. #include <linux/types.h>% `: Q; l: S" G0 i. @
  29. #include <linux/interrupt.h>* Z% e6 r1 d# u; S. b
  30. #include <asm/io.h>
    6 S. w/ X( Y! J2 {0 p7 z
  31. #include <linux/moduleparam.h>  ?" l1 f% n" n% B" [7 K
  32. #include <linux/sysctl.h>
    : R- ?/ L# C$ ^0 k3 ~( R: V
  33. #include <linux/mm.h>
    & r6 U: G5 E3 P3 d+ I5 V, W. E8 v
  34. #include <linux/dma-mapping.h>$ E' l- s. d, W- w  u* G
  35. * N8 l7 a9 m* {3 _+ H' L/ i% m$ d9 ~' d
  36. #include <mach/memory.h>1 b  M4 e2 f6 |2 S1 N
  37. #include <mach/hardware.h>
    3 W& `! \/ L+ P5 x3 T4 C& T
  38. #include <mach/irqs.h>5 J4 ^9 E6 Z- ]/ J
  39. #include <asm/hardware/edma.h>( W% f  o5 F7 K9 P$ G  F" @3 K6 ^

  40. 0 t5 K7 ]! g5 d* B" t8 V' ]4 }
  41. #undef EDMA3_DEBUG
    / @. u6 r7 }6 P3 k/ z
  42. /*#define EDMA3_DEBUG*// V/ ]0 [8 F- N$ Q+ f

  43. & v3 ~; V  N0 [0 i  Q0 F/ I
  44. #ifdef EDMA3_DEBUG' ~- x1 c# B- {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- g/ I/ A  F0 O" G- e" N2 u$ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  L( Q/ `3 t3 N1 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). R; p+ Q$ W7 b9 G: X! Y, I! j1 a
  48. #else# o7 H; J7 ]9 r5 }! S3 ~& E
  49. #define DMA_PRINTK( x... )
    6 j7 ~# s6 E+ |! F
  50. #define DMA_FN_IN
    6 I3 g0 @  G3 u- [
  51. #define DMA_FN_OUT( b# ^2 z' G9 ]6 c/ ^! p9 R9 _
  52. #endif
    * ]0 W( ]9 U5 \% W

  53. 9 V) i) _' m% p$ D1 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 d, ?7 V! K1 V1 Y# D
  55. #define STATIC_SHIFT                3
    8 L& y3 R2 D. v/ p3 W
  56. #define TCINTEN_SHIFT               206 b* J: k* B% _3 p# r! l, u
  57. #define ITCINTEN_SHIFT              218 ^, d7 B' a2 ^' k; _1 T7 @
  58. #define TCCHEN_SHIFT                22
    3 F: ~& I/ k/ ]- g, v
  59. #define ITCCHEN_SHIFT               23% Z4 [! W& q8 f

  60. : U) }4 f; E8 B! @* Q
  61. static volatile int irqraised1 = 0;) s' B8 Q' O5 F1 p" K8 c) m
  62. static volatile int irqraised2 = 0;
    # U. E3 _4 Y3 Z" h
  63. * ^) n7 S9 ^9 U. m3 X' C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - x3 C+ N& X/ y1 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. s0 }+ U7 z8 j3 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) x$ }, X0 Z) g% W- P
  67. 4 U7 q" h7 Z0 _. x8 R8 W
  68. dma_addr_t dmaphyssrc1 = 0;
    9 O( r, A# t/ O  Q5 R: P
  69. dma_addr_t dmaphyssrc2 = 0;$ ~5 _3 @1 |8 [$ }
  70. dma_addr_t dmaphysdest1 = 0;
    ( }' \" h/ {# k( S$ b/ P+ _
  71. dma_addr_t dmaphysdest2 = 0;
    , }3 n9 x3 a. d5 n* ~2 A
  72. ! U9 o7 p5 a* i% q4 u
  73. char *dmabufsrc1 = NULL;
    3 h# S0 V# ]5 ]  J) `1 `$ r
  74. char *dmabufsrc2 = NULL;
    / Y+ {  c# }6 c. R7 X# y; I  ?
  75. char *dmabufdest1 = NULL;
    + ^0 [3 x. n6 S9 C9 B
  76. char *dmabufdest2 = NULL;5 X6 {6 y* _# j, j4 R5 y7 w
  77. . S. g9 u* y  R3 l7 n0 `% F7 d
  78. static int acnt = 512;
    * {0 n4 h5 q2 D' u" l
  79. static int bcnt = 8;
    ( t6 ^' ?- ~$ z) a0 a5 \2 J
  80. static int ccnt = 8;
    * J6 R& D6 a$ [" L5 ^1 A1 F& o
  81. 5 j0 o8 O6 j0 y; C8 }2 E
  82. module_param(acnt, int, S_IRUGO);
    % v( V1 a- h1 p; X4 F
  83. module_param(bcnt, int, S_IRUGO);
    1 B, u+ c; p2 G8 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: o# H& h1 d+ @- p7 g; G+ W3 E+ |5 p

3 M2 H* g8 n  ?0 C- y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 P( S6 C$ E; D/ Q: darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ I* x/ x* Q! ^/ h) {1 ^/ J& l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 k2 \+ r0 z; G+ p0 d
. o6 i, b, u4 _7 n% r" z( O, o: B
( z2 L! F" P- O8 ]2 x7 p" |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 16:12 , Processed in 0.041612 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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