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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 W0 C, y& g* _) `' K4 K" N% T
  1. [code]EDMA sample test application
    5 u9 {$ B* I( S
  2. /*
    + w2 }% S0 k4 Z" U" a. W9 \
  3. * edma_test.c3 ~1 N7 ~9 A6 n: [: u1 o
  4. *- I3 Q7 g' _% {0 x  ^  y6 V
  5. * brief  EDMA3 Test Application$ e5 H+ m' P9 p) E+ h* r/ q+ f
  6. *3 \, |9 W/ ?# c' H, D
  7. *   This file contains EDMA3 Test code./ H. D5 a1 u. w
  8. *1 w+ j9 ?& b: b% g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . y3 p( \! a! d# j0 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: r4 s/ ^: f! Q+ F  s$ F& x
  11. *         TO CHANGE.
    1 ^( R) V& E$ [& s7 D6 v) Z
  12. *
    - Y& b5 S' d2 J0 W/ z/ d. Q% S6 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ y' P" P) O! u# g- p: B
  14. *, c0 L9 {6 t, T6 O
  15. * This program is free software; you can redistribute it and/or! E7 ~; m) D$ F. O( c
  16. * modify it under the terms of the GNU General Public License as
    - l6 s7 K) U! E8 Y, T/ A: z
  17. * published by the Free Software Foundation version 2.# a+ x& l2 G' {
  18. *7 g' e- {- `, I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Y0 A  S8 V7 I; P# d. W- L/ m" P
  20. * kind, whether express or implied; without even the implied warranty
    ( Q( G8 b6 d( y' D! n7 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, P' ~# s2 P' B4 g! g  }/ f6 j) W3 k
  22. * GNU General Public License for more details.
    ( g, x/ W1 g& ^" r/ {' f: k
  23. */
    - Q6 b) A# [1 x3 a" [# r

  24. % U2 y8 S! p6 Z0 F( Z4 j5 C
  25. #include <linux/module.h>
    2 W9 X( f  {) I
  26. #include <linux/init.h>  ]; j% C$ {9 X2 |! e! G
  27. #include <linux/errno.h>* q  x( g5 J/ `# d7 V; e4 g
  28. #include <linux/types.h>& C! L) [( X5 w/ B
  29. #include <linux/interrupt.h>
    % v4 r$ p. ~( j3 z4 |. ~; _2 T
  30. #include <asm/io.h>; t4 Y6 P0 [0 U& `! h6 L' c
  31. #include <linux/moduleparam.h>
    * O+ T+ {% M; W2 E- U& J9 |8 m% _
  32. #include <linux/sysctl.h>  I. p4 {$ o& Q- H1 G" s; j
  33. #include <linux/mm.h>
    " j7 H8 R3 p7 ~/ k5 a- r
  34. #include <linux/dma-mapping.h>: v% ?( M  }  S6 ]2 Z* }+ Y* S
  35. ) g* z4 `  n* H  s) N0 P+ F5 w
  36. #include <mach/memory.h>: t8 [9 L' g+ j  G- T
  37. #include <mach/hardware.h>
    7 b- K: b3 u1 q( l" |
  38. #include <mach/irqs.h>; a5 x* F3 p) @+ b
  39. #include <asm/hardware/edma.h>
    * I: o8 i7 G: x+ A2 p  m! q1 U3 S

  40. 2 Y6 q4 P' p. p% w! u
  41. #undef EDMA3_DEBUG
    6 m! [- }' n) R
  42. /*#define EDMA3_DEBUG*/" w0 J3 Y$ ]& ?: i' c
  43. 6 O& ~9 {# ~; X5 F6 k; u
  44. #ifdef EDMA3_DEBUG
    3 }/ r- N9 b5 W) S1 M# T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / P2 F. {( F7 N5 v% s# E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : W+ n; ~' J! ]' y: W* D. @4 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): O$ v1 s7 O- k0 m
  48. #else
    1 A- q: s! V/ s" @# ?
  49. #define DMA_PRINTK( x... )) k( Q: d# t7 Q& b
  50. #define DMA_FN_IN
    " ^* o7 _' a" P- }
  51. #define DMA_FN_OUT
    & I( S( c$ u% |7 J8 |+ A% [
  52. #endif' x( i5 H9 t( S# r: B6 L

  53. 8 N, G2 z( j; w: R+ X/ W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , a6 R- }9 D5 f3 f8 O% N  s, _7 V
  55. #define STATIC_SHIFT                3
    8 `* J, `& {: F0 l1 p. h2 P
  56. #define TCINTEN_SHIFT               20
    ' Q" I# h/ Y7 s$ W
  57. #define ITCINTEN_SHIFT              211 v# |* I  R0 J9 T
  58. #define TCCHEN_SHIFT                22
    4 a: g: q( o( z; A0 z1 I, R! y! T* A
  59. #define ITCCHEN_SHIFT               23
    2 d1 D2 F# z5 A/ D
  60. 7 [  v% D" s4 h
  61. static volatile int irqraised1 = 0;/ G5 @4 \% J2 e7 }$ |6 j% E
  62. static volatile int irqraised2 = 0;' T; t/ P3 Z. z) s# _8 c, a& {
  63. ' O5 p( ^4 b4 t' K  n! L# ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e, \8 `5 R% p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ H# a+ h* a/ W/ q) J; S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : X$ x1 e$ e/ Y5 S2 Q
  67. : z+ M0 G3 n, @) z3 ?
  68. dma_addr_t dmaphyssrc1 = 0;4 ~+ q7 n, G4 q6 g% Z
  69. dma_addr_t dmaphyssrc2 = 0;
    * _, _5 s# r" ?5 Z, N8 D! \& h0 Y& D
  70. dma_addr_t dmaphysdest1 = 0;
    ) S' Q, y7 p9 J8 }5 D
  71. dma_addr_t dmaphysdest2 = 0;- J0 }+ x/ O% T2 p3 d% o. _5 n

  72. 9 J1 B- ]2 E3 u7 S2 P% O0 e
  73. char *dmabufsrc1 = NULL;7 Q( m5 f2 R6 X8 @! B1 X. _* D
  74. char *dmabufsrc2 = NULL;3 Q' }. ~; I4 t9 i, W/ K: U0 _( r
  75. char *dmabufdest1 = NULL;& D) X  f/ X+ }) Z
  76. char *dmabufdest2 = NULL;
    - Z% b: |. j- w, I/ z
  77. # X$ a( ?% u/ {8 \
  78. static int acnt = 512;$ h) j0 Q6 W$ f4 _
  79. static int bcnt = 8;/ N; J( U( r, k- u* g
  80. static int ccnt = 8;
    8 f/ |+ V" v6 F& _% K$ y. d
  81. , ?) X1 U  x3 N5 l3 r
  82. module_param(acnt, int, S_IRUGO);
    2 c0 s5 \! T# Q" g
  83. module_param(bcnt, int, S_IRUGO);3 S* w; |* q% j# {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. o6 z* o$ |1 L# I. \

  I7 t5 N0 J$ z( K2 p7 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 a( t9 w- [- d2 [" ]) n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; s) E5 B- _, {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G- G+ @' Q# {) \: r/ b" T

6 M& U) ~" z- G% `2 o: Q$ Y, z" y- s1 x4 M& i7 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 14:57 , Processed in 0.039064 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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