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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ~4 F6 d. C( x6 u! K% ]4 D
  1. [code]EDMA sample test application% I/ K  u2 _/ R" n
  2. /*, j+ c1 o3 B- u! J% C
  3. * edma_test.c3 f' {  l0 N3 I. [; T3 b" x, P
  4. *
    2 B0 h, k3 L2 d- D
  5. * brief  EDMA3 Test Application
    . L# J+ T7 L0 a' `
  6. *8 J9 T9 D% _2 B( E
  7. *   This file contains EDMA3 Test code.0 y8 r) W8 \- K" a) H
  8. *4 }- k( b& i1 v% y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. t5 N% N$ v  U& E  D. U8 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , M: _# G. _0 D1 I" ?* I
  11. *         TO CHANGE.
    7 G; B5 q# B2 E; B4 i3 q
  12. *
    : L) g  N7 B0 \7 {" O8 K! M0 B9 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 B. c+ |$ {- ^" ]- b" r; ~
  14. *
    # Y7 O4 ?6 S% {4 X$ q1 d. B
  15. * This program is free software; you can redistribute it and/or
    9 Q: @2 Y5 r% x1 q' \& e
  16. * modify it under the terms of the GNU General Public License as
    $ y) k! N2 T  Q1 {: G
  17. * published by the Free Software Foundation version 2.- v& A- l9 s' R6 H5 g/ T
  18. *
    % ~$ u. p/ F: Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 J# Z; }! r9 _" _; o3 J
  20. * kind, whether express or implied; without even the implied warranty
    % v: h8 H; W9 K* H  E0 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ a1 B9 q* e" Z% W5 C
  22. * GNU General Public License for more details.3 o  ?  R& Y/ x0 b( m
  23. */2 ]: H" f9 T) Q" }" V- D

  24. 0 |( k, ~& P- S2 ]6 m
  25. #include <linux/module.h>7 y# Q* X& N0 R
  26. #include <linux/init.h>% R4 s  d3 C! R5 g- E
  27. #include <linux/errno.h>' ~% V! Q# U+ R  O6 b2 o, K
  28. #include <linux/types.h>, z, H6 U% M2 L% ^' I, D
  29. #include <linux/interrupt.h>
    8 N* y4 v8 m  W; L. G, B
  30. #include <asm/io.h>  C5 K: q/ T7 z4 g) y
  31. #include <linux/moduleparam.h>* c0 q& S- l/ ]' [
  32. #include <linux/sysctl.h>
    4 Y7 v. J6 r2 S
  33. #include <linux/mm.h>
    % `  W& ^' m1 z3 X
  34. #include <linux/dma-mapping.h>
    3 J6 y4 n3 ]# O0 ^, T7 d

  35. - m# P6 E/ s* M6 T. X1 X
  36. #include <mach/memory.h>
    : U& w: L/ x9 x& f) A  M' g
  37. #include <mach/hardware.h>
    8 @! T2 ~# A3 z, Y. v: x
  38. #include <mach/irqs.h>
    3 }1 `) G3 H1 f7 d1 X" _
  39. #include <asm/hardware/edma.h>4 `) V# b/ q; T5 l( d
  40. * V4 E- x2 i9 u$ P
  41. #undef EDMA3_DEBUG
    ' S! ]4 a$ z% k- l8 {( I1 i
  42. /*#define EDMA3_DEBUG*/
    ' T2 \5 f3 j+ D" o; E! R

  43. , C2 v8 L' z' \) P3 n
  44. #ifdef EDMA3_DEBUG1 q5 Y0 z$ W1 M9 W5 e8 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 t8 R- g  c  a7 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 d0 A6 E3 U9 S8 u$ o3 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " A1 N& }2 }! t! j- [: V
  48. #else6 K8 q" [  |9 \! h0 |% c, s
  49. #define DMA_PRINTK( x... )
    , B0 \( X) F" ?5 ^2 g
  50. #define DMA_FN_IN
    " @' ?; w% U: ?" R
  51. #define DMA_FN_OUT6 M7 ^; t( f7 F! }
  52. #endif
    + b! ]* M* b! l

  53. 6 m- Y. u3 Z7 w9 ]0 \1 v2 X, \% g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) H! o0 J+ Q8 B6 \2 S
  55. #define STATIC_SHIFT                3# r1 O. ?+ ~6 b- M+ T
  56. #define TCINTEN_SHIFT               209 d% `- p1 u- X$ P. g
  57. #define ITCINTEN_SHIFT              21
    ' M  j3 ?( N6 n+ D5 g2 v
  58. #define TCCHEN_SHIFT                225 }9 d9 A/ ]- j" h  S+ |: F  f: ]
  59. #define ITCCHEN_SHIFT               23
    " b1 e6 K, c6 a# P

  60. . G3 s. y, u8 H/ a) J6 Y( @
  61. static volatile int irqraised1 = 0;, Q. j- N* p+ u1 H+ o; }$ i' `7 l8 W
  62. static volatile int irqraised2 = 0;
    + `* E! ~! z; r( f! E& @

  63. ! z9 m1 X( W/ u% I  I) k# t3 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. s5 o# X! y) `, ^/ Y7 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 p8 ~) f( N/ k1 a- l7 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 R$ F  k0 S- e' s

  67. 0 \! d; w3 l9 j+ E
  68. dma_addr_t dmaphyssrc1 = 0;
    $ R5 }8 i' G5 k: @" S! i
  69. dma_addr_t dmaphyssrc2 = 0;! G' Q! g( O- C* [
  70. dma_addr_t dmaphysdest1 = 0;
    * R! J5 p/ W1 O% v  W
  71. dma_addr_t dmaphysdest2 = 0;  I0 p- V+ z& E2 y

  72. $ L+ ]5 E* y6 ?2 w1 S# r8 h
  73. char *dmabufsrc1 = NULL;
    + R1 O7 }' B5 |! G2 b0 X. \
  74. char *dmabufsrc2 = NULL;, @& f' Y3 }' N9 b& G" ^- e
  75. char *dmabufdest1 = NULL;, M  i  _' ]  g' N5 U1 B# p
  76. char *dmabufdest2 = NULL;
    ' z& c8 G) M4 S; R
  77. * L' }5 M( l; ^! l
  78. static int acnt = 512;
    6 C4 Z; v6 Q: @" [
  79. static int bcnt = 8;
    & u! Q/ p+ ]% S0 h' u; T9 l
  80. static int ccnt = 8;
    ( B& w5 e$ d: t9 u8 J

  81. + f! P; `9 ?( {) ]) T0 l' e8 L
  82. module_param(acnt, int, S_IRUGO);
    9 T9 h& C* v4 W1 B
  83. module_param(bcnt, int, S_IRUGO);
    , {; E2 |+ O' C, X, h4 a5 s( B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* J6 H* {3 c+ ^% W$ ]- A

1 [$ j$ H7 {1 S* r0 I7 u9 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. Z. Q- {+ `1 u1 t( E1 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( L2 m$ b" V4 f# z( D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* {- u% m& F  a# A# i+ L, X
3 i+ n4 k# k4 T; d+ A3 ]" y3 U! H/ g/ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 22:18 , Processed in 0.039484 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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