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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 l0 A8 V( Q% G3 f( v
  1. [code]EDMA sample test application3 p; k3 x3 g0 L- r! b" ^2 b- _. v
  2. /*- q2 h6 y. _8 C2 [1 o  p7 W7 ^
  3. * edma_test.c3 a) D; U8 G# {6 n, L) M
  4. *
    " l6 r- G& {; M
  5. * brief  EDMA3 Test Application
    4 Z( x9 u+ F0 a# S
  6. *
      j/ z; Q6 O4 N
  7. *   This file contains EDMA3 Test code.5 H2 R8 Z- [  X. f. k9 R
  8. *7 v5 Y0 t- ]3 w% ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 Y! F- P5 b8 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % c. j8 d% z. ^4 K9 `7 ]
  11. *         TO CHANGE.0 Y4 T1 w: k# ?, q* X
  12. *
    " l9 u2 D5 m% E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # ^& x! z; C3 f& E3 D
  14. *7 c1 D3 }0 o8 q0 j0 l
  15. * This program is free software; you can redistribute it and/or
    6 \$ b: e0 }, n2 z& a
  16. * modify it under the terms of the GNU General Public License as
    ) V& m8 @4 P" w9 |
  17. * published by the Free Software Foundation version 2., B- e( U; d- i4 i2 I) p
  18. *$ o5 ]9 z: {0 P  m+ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ \/ ^! A% B# {/ l& i( k
  20. * kind, whether express or implied; without even the implied warranty0 _& O5 _1 y2 J0 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. ^/ c. y) p) J# _$ _* h
  22. * GNU General Public License for more details.
    1 {0 X4 e2 P# R+ z. }9 R
  23. */
    ( v! @* A/ A" ^7 p( ]2 E* U$ W! `

  24. $ W- B3 J: x' a1 b2 w
  25. #include <linux/module.h>
    5 ^* Q: P+ s: K: [' y, j, k
  26. #include <linux/init.h>( ?% S8 C0 n9 u/ L2 r/ {
  27. #include <linux/errno.h>
    " o4 K" ]: C, _( E/ V' p$ p% x4 p
  28. #include <linux/types.h>
    8 W! \/ U3 o+ N7 b" z3 t" v% W7 k
  29. #include <linux/interrupt.h>- s( M# M( ^! h. r* a# k) c
  30. #include <asm/io.h>
    8 g+ U2 f1 e+ K( ]  n
  31. #include <linux/moduleparam.h>
    5 ?) x2 J$ `) C  q( h! r# V
  32. #include <linux/sysctl.h>" j  d6 o8 f, b$ y! L
  33. #include <linux/mm.h>
    7 L! y( j1 |' B/ R! a- P
  34. #include <linux/dma-mapping.h>  v5 `- H) g* j  o
  35. + V* M3 e7 g0 S8 [8 r& G) I5 P
  36. #include <mach/memory.h>0 _+ O  E) X& F
  37. #include <mach/hardware.h>
    $ r  e( h. X2 q. w( p5 Z
  38. #include <mach/irqs.h>6 k$ }3 D, p, a
  39. #include <asm/hardware/edma.h>" a$ s; q- [$ F- u7 s% P, V& p

  40. ( f0 o, k7 P9 \$ y( v
  41. #undef EDMA3_DEBUG
    % ]0 [$ |% S6 Y) ]% d, S
  42. /*#define EDMA3_DEBUG*/
    : w2 v1 k* Z$ g' U$ O

  43. ' E+ d) s! J" p6 d2 Z$ Z: O2 a
  44. #ifdef EDMA3_DEBUG: c0 ]7 F- ~" Z, @5 K8 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' O5 Y( s+ ?* i/ ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ Z1 `+ [4 O& |( w& a; W. c( V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % e8 `# d0 i/ q/ X' @0 J
  48. #else( S; \: ]; S# {0 |
  49. #define DMA_PRINTK( x... )( @& t/ A6 K- ^7 T
  50. #define DMA_FN_IN
    8 \0 K& Q- C0 }% }! ]( Y  |: e+ I7 V
  51. #define DMA_FN_OUT
    $ s8 p6 Y2 o8 I" M
  52. #endif
    4 G( C0 t% F  k0 K# P

  53. + L' L3 t9 @( Q/ l) h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% K* I1 w6 G0 s; N' x
  55. #define STATIC_SHIFT                3( }) H" F0 Q4 G( U% q- r
  56. #define TCINTEN_SHIFT               20
    0 r- b% y- d( M" X- ^( P# L- P
  57. #define ITCINTEN_SHIFT              21
    0 {* r9 E7 [! _. q+ m
  58. #define TCCHEN_SHIFT                22& {9 h( g. a1 f- ^
  59. #define ITCCHEN_SHIFT               23& r2 t: G5 S7 P) z& R# F% w
  60. 7 B( `" ^3 U) k8 @& y. q5 \6 w
  61. static volatile int irqraised1 = 0;
    # _+ g) q4 P: V
  62. static volatile int irqraised2 = 0;% H0 o) K- I. x/ W0 }: X

  63. ) r9 y, H. R6 Z) C. U! o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]; K5 r7 L. K& C5 D# s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `" n( S- P% I8 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l9 O( y5 P1 U
  67. 1 w( R6 K6 u+ b. ?% t  |
  68. dma_addr_t dmaphyssrc1 = 0;& q7 s8 B- T2 Y0 S# T/ W, U
  69. dma_addr_t dmaphyssrc2 = 0;1 m! }0 s2 |. a
  70. dma_addr_t dmaphysdest1 = 0;9 W, P" |/ m2 G9 ]5 N
  71. dma_addr_t dmaphysdest2 = 0;9 v7 v( M0 R( a: t9 ^' s

  72. ; ]0 {  E5 t( ~0 b7 A
  73. char *dmabufsrc1 = NULL;
      |9 C/ M: Q# w+ I7 ^
  74. char *dmabufsrc2 = NULL;: M3 F, H8 G& w+ e
  75. char *dmabufdest1 = NULL;
    ( k1 I  M* U' u- ?) z: n0 ^5 [
  76. char *dmabufdest2 = NULL;
    9 L% k/ J) A' c
  77. ( u6 v+ _0 C" ]. N! b3 o( l, i0 T4 N
  78. static int acnt = 512;  s, G$ J) P4 j# }) d  A. I! h
  79. static int bcnt = 8;
    0 h0 r5 }" u3 J# m# ~
  80. static int ccnt = 8;  ?# z) E0 S% |4 v/ d
  81. / |8 U1 k$ }7 m" h
  82. module_param(acnt, int, S_IRUGO);% {: g( x2 w" x: i2 p' z
  83. module_param(bcnt, int, S_IRUGO);' A5 `9 h, v1 V( C. ^& z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ q) u- L, q+ h0 u
2 l0 R0 l7 k0 v5 B2 i$ m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ C9 c0 I( X2 C/ darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, r- h. J- E7 `2 ^' k2 {' k$ z# o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 r/ |, Z) I! @6 r1 s8 N: L
: J9 z' I& A9 n1 c

" u: H( `- F! t4 y: l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-15 17:56 , Processed in 0.041396 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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