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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 @1 L4 @- ]$ W" l2 M5 A
  1. [code]EDMA sample test application( d: ^) S% Z( P
  2. /*
    " k4 }( X/ y! {) |) _( I) W
  3. * edma_test.c3 c4 v3 J* m" o; c; P+ B3 p  Z! ^
  4. *2 W, \9 v1 I9 s( B
  5. * brief  EDMA3 Test Application7 q0 \+ n: i: k/ Q
  6. *+ E/ U4 a6 F/ c- E/ H' A# o" y
  7. *   This file contains EDMA3 Test code.4 I/ |& F3 N  r$ R
  8. *
    5 h; D1 O% m3 ~* o/ q: ~0 z; F+ q- o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % |% r7 l+ s& N3 X: e6 m( I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + \" [; S: q2 R8 [
  11. *         TO CHANGE.
    ( n  T# P3 D4 p) ?" N5 n
  12. *' c& i8 q8 [( T! k  K; F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ X! x+ @; F6 M' s) @
  14. *
    ) D! U5 P8 c+ F, c; `2 |
  15. * This program is free software; you can redistribute it and/or& Q; [; Z0 N! \+ N9 B
  16. * modify it under the terms of the GNU General Public License as2 z2 o, s: C& v+ m6 L, |6 \
  17. * published by the Free Software Foundation version 2.  B, _+ U; _4 d
  18. *0 F, W: z9 Q" j( a4 B$ L/ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  m0 J3 \6 Y7 B' r; b" r& Q1 Z
  20. * kind, whether express or implied; without even the implied warranty
    * e% B8 `0 r4 V  [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' a5 g+ d, g9 [; Y
  22. * GNU General Public License for more details.% |+ v+ g1 b  J2 ~; [7 Z- Y9 O' L
  23. *// M4 O2 V( ]8 @& E* J* y0 o

  24. 9 \8 A" C, J1 }5 E# u3 ]
  25. #include <linux/module.h>% U2 i0 H# _( `: h
  26. #include <linux/init.h>  d  u$ S8 J3 K2 S3 d$ f
  27. #include <linux/errno.h>
    6 ?/ I+ E3 n9 u# R7 W1 w
  28. #include <linux/types.h>; J$ z  K4 O4 A5 U3 `3 m
  29. #include <linux/interrupt.h>9 z4 K8 _. G* Y# Z
  30. #include <asm/io.h>4 B: W: c% Z# T. m3 S1 R  S0 b
  31. #include <linux/moduleparam.h>
    4 x- J; B/ r$ Q7 v& F
  32. #include <linux/sysctl.h>4 P- O7 x; P. g- y
  33. #include <linux/mm.h>9 @) A' G" _4 ~. I9 s7 h" ]' }
  34. #include <linux/dma-mapping.h>' D3 I4 y& p9 O( p+ u% J

  35. - P* C* J- h1 g/ x9 {
  36. #include <mach/memory.h>
    . Z! @! t3 [5 e
  37. #include <mach/hardware.h>3 W6 M; ]9 C/ W. Y! Y
  38. #include <mach/irqs.h>8 h- H2 n3 X3 @* d! H- O. |
  39. #include <asm/hardware/edma.h>
    1 u3 ~/ E" X* [6 D# c

  40. % W/ ]4 u/ u1 o) g2 z5 Q
  41. #undef EDMA3_DEBUG
    5 ^2 R* X1 |) d
  42. /*#define EDMA3_DEBUG*/
    " R9 D8 ?2 @6 l7 R- p" d
  43. 5 Z  S. y/ @" D* `& k  c8 g
  44. #ifdef EDMA3_DEBUG, \  `; V" |$ L' N& _' _" E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# r0 d* m$ k5 q5 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' V8 e6 F5 [  h9 s& f# T$ ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + _+ B, }) G5 p% V+ c& X$ H
  48. #else
    3 J5 p5 \( A( D/ d
  49. #define DMA_PRINTK( x... ), t! l8 {9 q) o/ t$ J
  50. #define DMA_FN_IN, i% p+ \5 Y. {! |  Q# s& \6 D% K
  51. #define DMA_FN_OUT; |) w) E- M1 \. E! z% ~) y- o
  52. #endif  K5 c3 ^5 k0 l8 g  F' i

  53. 1 n: n& H  S2 G$ H; ?3 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % ?4 K. U4 E) c3 r5 y3 X
  55. #define STATIC_SHIFT                3
    " |# N: _: b- r  z
  56. #define TCINTEN_SHIFT               20
    3 n; ?/ T2 q# |0 M  T& x
  57. #define ITCINTEN_SHIFT              21
    ) T" g/ C% f2 a
  58. #define TCCHEN_SHIFT                22- I+ i7 }3 S7 @( V" V
  59. #define ITCCHEN_SHIFT               23
    6 f  R/ N4 H& D+ R6 {. e4 T

  60. * @! c2 w& v# q3 S. J# _! Y
  61. static volatile int irqraised1 = 0;, P7 t7 g+ M" C" B8 J
  62. static volatile int irqraised2 = 0;
    , p: e4 U6 [6 D8 Z

  63. 5 \( A4 e. ^8 b3 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 I. z2 M+ W+ w8 M/ a* p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' z  M1 N& @8 O8 |% Q2 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 K2 C9 f0 P; S& _6 K
  67. 0 ^  Q' [+ R+ O0 U9 h5 M5 H
  68. dma_addr_t dmaphyssrc1 = 0;# ?7 U3 j1 v( _3 H9 W2 }" w. i
  69. dma_addr_t dmaphyssrc2 = 0;
    ) t) t- K' g9 H! Y# s6 z
  70. dma_addr_t dmaphysdest1 = 0;
    ; P! o1 w( `  G7 T8 i, a" h: O
  71. dma_addr_t dmaphysdest2 = 0;
    . g) d' i. C6 t* d
  72. ! J3 U, Q3 }9 ]* _0 T* D
  73. char *dmabufsrc1 = NULL;
    8 x0 o' T4 I# W7 \
  74. char *dmabufsrc2 = NULL;9 J) n( f- k# W
  75. char *dmabufdest1 = NULL;
    + P' C3 ?! ^: @1 @6 P/ V$ [! a
  76. char *dmabufdest2 = NULL;
    $ t; t5 M5 y+ u4 |' ?' d( N7 `

  77. 0 a4 f, \6 m! d  z
  78. static int acnt = 512;
    ) i* L% r8 g  r9 s
  79. static int bcnt = 8;
    % D! x+ M. }* a; R
  80. static int ccnt = 8;
    + ^9 R  {5 U( n: r

  81. $ D9 [/ w/ i* z2 R
  82. module_param(acnt, int, S_IRUGO);
    ) I& g8 }$ K, |* }: [+ N! D
  83. module_param(bcnt, int, S_IRUGO);
    2 @" P. t( q! S- G  B) J, s# ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& \, s- k7 U( [+ K- n/ b
( Q# \4 f8 c+ X( K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 I* Y- J  n& s  R6 k0 R4 C6 l* {- r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 z! H8 }. f( b. C# R$ ?& W& |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 {( G- b! Q0 X1 P9 F, o
" r, p9 b8 q) v. j% T- ]
; a* j9 V% @2 f, }9 _5 h& f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 15:24 , Processed in 0.048845 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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