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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / q2 q+ e2 a+ K* O! Y0 Y
  1. [code]EDMA sample test application. W6 \& R5 F3 i
  2. /** c6 K+ \. T9 g- }  P( a
  3. * edma_test.c
    : ]4 B/ q( [* t9 M, J% c
  4. *
      K" E0 E% ]9 g# n! n" j4 V1 m
  5. * brief  EDMA3 Test Application( N- e1 x# Z! K; y2 i) z/ s, Y
  6. *
    ( s% v, `( D; S0 p2 |
  7. *   This file contains EDMA3 Test code.
    9 Q2 X. r' ]% b. q  M9 g
  8. *# g, H/ B" b1 `3 O+ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! E+ l. v3 y2 k* a2 t8 S; z' ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      h) d+ H- |% A$ _& r2 ~8 Y& e
  11. *         TO CHANGE.1 s% `* H" A# L9 S  o! Q0 W
  12. *+ }, ~) v) K! j  I5 v6 ?( Q; c% l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 h0 B  v+ L$ ]2 e/ G
  14. *
    9 _- H! p' U1 D: n
  15. * This program is free software; you can redistribute it and/or$ @% ~  z& `; [6 ^
  16. * modify it under the terms of the GNU General Public License as4 }# ^( t# w) a
  17. * published by the Free Software Foundation version 2.
    4 e; M- B- {) ]2 [
  18. *
    ' J% [! B2 a2 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ?7 e' j; y; x2 N! p  L5 z5 c
  20. * kind, whether express or implied; without even the implied warranty+ W% H; F1 N2 i! i1 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 z' w2 m5 Y" K2 h6 B8 s; p+ ?" ]
  22. * GNU General Public License for more details.
    0 i3 r6 ^2 I  }2 ]/ S, @! i2 M
  23. *// q3 o9 R: \7 H' O/ V

  24. 5 S7 k4 f; W; r& O8 x- ^
  25. #include <linux/module.h>6 b# G" |; @, Q1 y  r) [5 d+ P6 l
  26. #include <linux/init.h>( }- |  `5 U/ |2 g
  27. #include <linux/errno.h>
    ; o6 J# o2 \; b5 d6 ]
  28. #include <linux/types.h># n) i8 k! N8 X' ^$ n+ E2 A
  29. #include <linux/interrupt.h>7 G1 M1 o! \5 q, R
  30. #include <asm/io.h>
    ; p7 L3 n" K! Y8 [) r! y% o: ]- }
  31. #include <linux/moduleparam.h>8 C1 F, W) ]- y: C$ N0 C3 b
  32. #include <linux/sysctl.h>
    6 T! `0 Z5 H/ l, g
  33. #include <linux/mm.h>
    * l- J% H+ U/ h: U( l
  34. #include <linux/dma-mapping.h>5 }. N5 B8 B1 h' z; w0 `8 Z! l
  35. ( f+ D1 C' V; W  P( n
  36. #include <mach/memory.h>( g6 h1 b5 Z6 z4 T. z' L
  37. #include <mach/hardware.h>
    3 ]- @3 p- k. j
  38. #include <mach/irqs.h>, l  P& l/ [6 o% ]! A, x
  39. #include <asm/hardware/edma.h>  X/ I6 P1 d& R9 s: p

  40. 6 I1 }7 L% o; s7 L
  41. #undef EDMA3_DEBUG4 \: Z8 \" v& Y2 ?4 K: c  C
  42. /*#define EDMA3_DEBUG*/
    , n1 K% C4 J" v/ N# ]2 V& v/ r3 c

  43. ) Y: a8 x( n2 I; U5 x, W0 O
  44. #ifdef EDMA3_DEBUG
    * U& T4 e* N. g# o' }, c" \4 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 A* @( T2 O4 s" U; j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) y+ T0 _2 O0 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , H. Q0 Z1 Z5 ?6 n% ~3 f
  48. #else6 T. w# ^3 u2 H7 ^0 e
  49. #define DMA_PRINTK( x... )* D3 U; m, E4 s" m, o5 E
  50. #define DMA_FN_IN9 J) E& O9 f( E4 A9 C8 t
  51. #define DMA_FN_OUT
    ) @) W5 D2 E! _, P/ Q$ K0 U
  52. #endif
    # f, Y0 [) I6 l; ?

  53. 1 F& ?% m  ^3 U/ O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 O# g# z. a5 o3 E- @
  55. #define STATIC_SHIFT                3: h/ j: O8 T. |, [& C
  56. #define TCINTEN_SHIFT               20
    " _0 S+ `! w* q: s& z1 Y
  57. #define ITCINTEN_SHIFT              21
    0 L8 n$ n! j/ }5 b" v2 u# ~8 r
  58. #define TCCHEN_SHIFT                222 b9 i1 |$ U8 {5 h
  59. #define ITCCHEN_SHIFT               23
    - @& `$ _8 Y7 b% l: O
  60. . ?' I0 q6 Q2 c' s1 `4 N5 U
  61. static volatile int irqraised1 = 0;6 p7 _% r) I% s# a$ \
  62. static volatile int irqraised2 = 0;
    2 l7 y: d. S5 H) Y0 V5 n

  63. 0 M' l0 m& p& `7 k  W7 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 {* v# S/ l5 Q! c3 G) b" L2 l( V/ |9 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( s$ s2 B" G9 N7 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E/ c( h7 o2 g5 g% t1 @

  67. 6 u: Y6 n  Q, c1 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    " z4 `; D/ G0 k5 B
  69. dma_addr_t dmaphyssrc2 = 0;4 @+ ]2 ?( S8 {& ~' d
  70. dma_addr_t dmaphysdest1 = 0;
    ( i. c7 I, }  J
  71. dma_addr_t dmaphysdest2 = 0;) n" k; z; L2 ?0 J2 z, y* t  @

  72. " S: p; [, I! V% K$ d9 c
  73. char *dmabufsrc1 = NULL;
    # V7 z4 H* o5 R& V7 x, Y
  74. char *dmabufsrc2 = NULL;" [' y# y# E5 }) }7 g
  75. char *dmabufdest1 = NULL;
    7 x# a, p' ~  s6 r# P2 ^
  76. char *dmabufdest2 = NULL;
    , [/ S6 a* ^0 H* _

  77. ) i, t/ l3 k: G& {- v* K/ R
  78. static int acnt = 512;/ l+ y- V2 p" Y" U
  79. static int bcnt = 8;) a: a" _% V% b2 K) S9 ~* _- u
  80. static int ccnt = 8;* {. ~2 S+ a2 d' t
  81. 4 W& \- A: I( q3 B( f/ e
  82. module_param(acnt, int, S_IRUGO);2 y3 o* v3 h" _
  83. module_param(bcnt, int, S_IRUGO);
    ) V2 }3 I8 U( ~" Y4 s# ~8 M& U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ N; W: [; X- ?! q' j
2 K" u9 M! U0 d8 I, Q: i! ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* r9 g- Y4 a+ B0 A! ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& z' v8 p+ }! X1 w; ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 g  C/ b  Y$ m' G2 L* h( Z$ j8 A
1 i) u& t$ s8 y2 x, P

" l: K7 N; K! o" B& n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 17:28 , Processed in 0.038005 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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