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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ B# K! m* S. v2 P2 O( _1 J- r
  1. [code]EDMA sample test application! ^: c! l+ ~3 v% Q1 T6 t2 y# h, X
  2. /*
    5 s6 V) l$ u( `- O0 \
  3. * edma_test.c' x; |- z. R0 H. U0 c
  4. *
    $ w6 Y7 n4 O' ^$ c- m0 _
  5. * brief  EDMA3 Test Application
    + R+ z8 B, n3 x' [1 S' ], A
  6. *) F* ~# G' S( Q* o+ P% a5 U2 v/ }
  7. *   This file contains EDMA3 Test code.4 y6 j/ R5 k: U) k
  8. *
    ) h; d/ J. u6 H: y9 C! d3 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * U2 o% M" z, v* m* [8 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 M; [( W1 t0 N2 B& @; B" ?6 X* H4 M
  11. *         TO CHANGE.6 Z5 F$ _- G5 I% z' O
  12. *
    / D* o1 ^) l' H' Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' D; B& l3 c5 i+ J' ?' H0 r# I# U8 D
  14. *4 ]4 O; x4 y6 d! h' u& H0 J9 }+ A4 |
  15. * This program is free software; you can redistribute it and/or
    ! j! [$ F) z' o1 e( @
  16. * modify it under the terms of the GNU General Public License as
    2 [) _  l1 f5 t
  17. * published by the Free Software Foundation version 2.0 o* W: [/ c" E) T- y; z
  18. *, J/ R( W0 d4 p8 c! N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 s8 {5 A, _. i2 W& y
  20. * kind, whether express or implied; without even the implied warranty( L) X# f0 q1 C$ C1 x6 j; h2 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( T8 y$ x" t. b& a* F8 n
  22. * GNU General Public License for more details.' x% z8 M9 H9 J/ t, e; M
  23. */
    . ~0 S3 C; P) I( `6 Y

  24. * M/ |* J% N% F! ?
  25. #include <linux/module.h>  |: C# K" ^- x4 F2 J- Y& C
  26. #include <linux/init.h>
    : U! z% |: l4 J5 n2 O
  27. #include <linux/errno.h>' E: @  |9 d1 p8 N9 u
  28. #include <linux/types.h>
    + u) Z( \2 c- o* a
  29. #include <linux/interrupt.h>
    & N: ]8 r, X) P2 H  y! z# F  K. }2 G
  30. #include <asm/io.h>
    : d& }7 w+ L; _3 P0 i8 Z. u
  31. #include <linux/moduleparam.h>6 C; g9 q7 O0 f( T
  32. #include <linux/sysctl.h>
    8 B" _2 X( T) W1 {
  33. #include <linux/mm.h>
    / z( Y$ _- g5 R5 M2 ^
  34. #include <linux/dma-mapping.h>
    + r. N; v' a. l7 B8 U3 J

  35. 5 i+ d& l$ p( X; g) }- h, p$ j# g
  36. #include <mach/memory.h>
    0 z* S: }# [+ ]4 e6 y9 _+ C
  37. #include <mach/hardware.h>
    ' n% c# O& ?# B
  38. #include <mach/irqs.h>
    8 X: g2 C7 H& W8 [
  39. #include <asm/hardware/edma.h>! \- Z3 g$ ]& Q% ^+ l+ }4 U0 E* e
  40. , _! P: {0 u; ?
  41. #undef EDMA3_DEBUG1 @7 D+ s2 F3 h
  42. /*#define EDMA3_DEBUG*/
    / z6 b. l( C2 {
  43. $ v" H* k) Y' T0 Y/ Z
  44. #ifdef EDMA3_DEBUG8 T/ ?/ s; O9 C1 k2 y7 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 ^7 O6 v2 ?! ]% |# s9 J. H3 \7 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 X* _" r  e7 _9 q1 c: k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 F! E6 }: E* a, }( y
  48. #else
    & v2 j. k7 O6 w3 _' x, m  a
  49. #define DMA_PRINTK( x... )
    0 }) y/ w3 k6 P2 ?/ E" A6 p
  50. #define DMA_FN_IN5 X( ]$ w! n3 n' c
  51. #define DMA_FN_OUT$ w7 o: j" N: B/ f" E( M
  52. #endif! g1 u! A$ z4 s6 f$ M2 \( d* V

  53. ) \9 _: ^% H0 I: q% ~; |% H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 Y5 J8 ~' N" j- K
  55. #define STATIC_SHIFT                37 Q4 D+ ~/ b0 x) E+ ~
  56. #define TCINTEN_SHIFT               20
      T; o; k  i- I- W/ ^
  57. #define ITCINTEN_SHIFT              21
    0 M1 J/ _) @' F1 J6 E4 [
  58. #define TCCHEN_SHIFT                22
    ' S. g8 @; j4 N, N; a
  59. #define ITCCHEN_SHIFT               23
    # ?+ u% E. p. |& J( s  q# P- M* R

  60. : o5 u% U3 y% C) ~& K
  61. static volatile int irqraised1 = 0;
    , A6 n! l! S% b9 c+ \8 y7 a) \1 q
  62. static volatile int irqraised2 = 0;
    3 F! ^6 c; N3 x3 O0 h" r# W; J
  63. 9 D# m# j+ u" @' Q7 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 w+ }$ X$ H1 s+ `; F. D" I6 ]3 K3 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & B1 N. F; w9 L' z8 _6 o4 N% ?* h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ k5 q/ S, Q& J$ \+ ~
  67. ( B7 L/ z" H' o# ^2 @. v1 i
  68. dma_addr_t dmaphyssrc1 = 0;3 f) ~4 _& s4 {. f0 ]$ G
  69. dma_addr_t dmaphyssrc2 = 0;
    # V% [. J* N  Y1 B; w
  70. dma_addr_t dmaphysdest1 = 0;' S% e& t4 m+ w, X
  71. dma_addr_t dmaphysdest2 = 0;' I2 O( m+ p  v/ R/ J
  72. / s3 x0 a5 v' K" l8 J
  73. char *dmabufsrc1 = NULL;% i  w9 r2 \7 N$ g, o6 L
  74. char *dmabufsrc2 = NULL;/ n$ `; J1 G6 ^5 t9 J2 v' u) J0 T2 W
  75. char *dmabufdest1 = NULL;3 u6 a3 w: P9 k4 A) t
  76. char *dmabufdest2 = NULL;. Y7 B! c) Z) s4 L
  77. & G) I# w# O" I: S  G
  78. static int acnt = 512;
    + U  {! M' E$ T: D# W6 u0 x: q3 U
  79. static int bcnt = 8;
    . Z$ D5 B) M5 U4 t% }( }% y. K& m
  80. static int ccnt = 8;
    9 H$ f# W0 d, |2 R+ e1 U

  81. 9 M# M; _( u- p
  82. module_param(acnt, int, S_IRUGO);( e6 r4 l6 O( U) o+ ]: k
  83. module_param(bcnt, int, S_IRUGO);$ O+ Z/ B. z5 o  D* C5 |: u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) h1 u4 t5 p: [1 l; i
, ?7 @3 r$ V; b8 \0 z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) n& R* ~/ e/ A: H7 Y& O! K+ b
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 s4 h& l  |6 M  D8 @, D' c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 b* ~+ S+ T8 f- e. @& Y+ c. b+ T6 y( s) C' R; p

* Q# n3 S" D8 H$ A" a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 23:24 , Processed in 0.039786 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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