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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 R  H/ A& q( s* U1 ^. v/ ]0 @
  1. [code]EDMA sample test application
    9 {; k  |9 s* t4 k8 H
  2. /*5 x" y  f( Q: l' f( u
  3. * edma_test.c& G: c& I' a. L3 ~2 w' v, }$ k
  4. *1 |- X+ t' e9 d: i4 \
  5. * brief  EDMA3 Test Application( ]1 D+ v0 n- E9 B
  6. *. L+ v2 Q) r6 \  y
  7. *   This file contains EDMA3 Test code.
    % C( `+ m; d4 [) r( S6 Q
  8. *' a1 ~. v2 U+ h$ C2 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! _' K' I. [% a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 D- @, l; i9 A& T: H) ^7 G
  11. *         TO CHANGE.
    2 y4 ]8 `" ]% _5 S0 H, o  C
  12. *  n. }$ ^+ j% g/ L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' H# P7 J5 ?3 G$ y) v# z
  14. *. A+ m! X) }6 ^4 L/ Z
  15. * This program is free software; you can redistribute it and/or  u& L4 N) A" [8 Y: s- s0 Z, g# q
  16. * modify it under the terms of the GNU General Public License as
    6 q4 S: k  d7 N& Q# w$ R+ G" I
  17. * published by the Free Software Foundation version 2.& F0 p* A  |  X' Y* d
  18. */ w# t# u* @1 w, K& h" e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# \* P, K; x7 E8 }
  20. * kind, whether express or implied; without even the implied warranty+ r/ K) [8 z/ p$ ^2 d, K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ w- \" m- l4 H! s9 g0 M
  22. * GNU General Public License for more details.! B$ N* ^# {0 ^" v! j& ^
  23. */  V* p" c1 w. j& {

  24. 5 t7 m' r5 y  k' z6 s1 X/ U
  25. #include <linux/module.h>
    5 G/ x' _2 a; A$ Y9 o  v1 b- k% t
  26. #include <linux/init.h>. F" x) P# @1 u& t1 K: l  c
  27. #include <linux/errno.h>; Q: V4 g. J# s# P' t
  28. #include <linux/types.h>5 x1 G; Z' T8 Y! u( W% X; x
  29. #include <linux/interrupt.h>& y) i  f3 ~( o* e
  30. #include <asm/io.h>8 |; Q4 m9 h3 k3 C) i% ^9 K9 d' U
  31. #include <linux/moduleparam.h>
    " D  }- K" W, l* N
  32. #include <linux/sysctl.h>
    * U+ H5 L" L, H' I  i
  33. #include <linux/mm.h>7 w3 S! X7 J' R) f5 S  s
  34. #include <linux/dma-mapping.h>
    . o2 \3 |7 s( @# b2 q3 q6 w
  35. : g2 N0 w6 Q6 d9 {6 i3 l+ D1 N
  36. #include <mach/memory.h>  Y0 h+ `; Q: e" Z! y( D2 K
  37. #include <mach/hardware.h>
    # J1 m/ `' n% ^$ f3 o
  38. #include <mach/irqs.h>
    7 b, [* B; [% e: q( q' ?/ s
  39. #include <asm/hardware/edma.h>
    / P$ E) O. C- h! B% _
  40. * \. \; _1 C" g: L# V4 @" w' u
  41. #undef EDMA3_DEBUG2 Z0 z; P, j  u- k% w5 V2 {8 R( I: ?
  42. /*#define EDMA3_DEBUG*/& r% s' E6 w9 l

  43. 8 |1 b; J8 |2 m/ F3 V
  44. #ifdef EDMA3_DEBUG
    & w( x9 l' r3 D+ F+ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* v. x* C3 o* J% a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) H$ p- |1 M2 G2 M, i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 c. N; B2 P" L; K8 T! c
  48. #else
    5 p) b2 |$ D( D4 H- Q- |0 g
  49. #define DMA_PRINTK( x... )0 v( I8 }5 \9 Y6 k9 s! ~( ?1 r9 u+ W
  50. #define DMA_FN_IN
    4 _$ C0 P- e9 G
  51. #define DMA_FN_OUT# F. R9 i3 g0 v8 Q: _
  52. #endif+ w& z8 c* E' `8 T5 S  u

  53. 1 N+ j0 I* A, F4 d' Y0 R" E' \3 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# i  {8 S- t) e1 t7 p' l
  55. #define STATIC_SHIFT                3+ x$ I0 P' ?0 O$ U! {' G( L
  56. #define TCINTEN_SHIFT               203 a/ g6 n7 ]  c# u6 T3 a/ H
  57. #define ITCINTEN_SHIFT              21; @& y& q* y( X
  58. #define TCCHEN_SHIFT                22$ W, c* @; L( g
  59. #define ITCCHEN_SHIFT               23
    ' s9 a3 `7 [+ `3 g
  60. " Z2 @9 v9 F  P6 O, |0 `
  61. static volatile int irqraised1 = 0;% W( z9 P7 q3 f9 u& L' i# z
  62. static volatile int irqraised2 = 0;
    : w0 o2 J! U5 C' Q6 U. `

  63. * q7 A/ c6 W" z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. |# X; v- J& c" t7 q6 I/ {# n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {. m7 L' N& v% L* Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " b4 K3 }! J$ J$ Y5 E4 n8 U

  67. 8 D- @7 r6 o" H4 {, \2 S
  68. dma_addr_t dmaphyssrc1 = 0;& T, x5 t& `& r  q7 g# S
  69. dma_addr_t dmaphyssrc2 = 0;$ s0 \2 S1 ?$ B
  70. dma_addr_t dmaphysdest1 = 0;
    - C+ u1 |$ e7 s) V" B& O* U
  71. dma_addr_t dmaphysdest2 = 0;# N, A, {. B$ [7 ~$ k3 K0 R& L/ p

  72. % y4 L0 ^$ q- B2 Q; |
  73. char *dmabufsrc1 = NULL;
    ! N% w( J; k6 Y2 A9 s' ?$ i$ k
  74. char *dmabufsrc2 = NULL;
    . p/ Z8 p- N) _& r
  75. char *dmabufdest1 = NULL;
    8 `7 p: o/ f( q  Q" ]
  76. char *dmabufdest2 = NULL;+ V1 r+ a( g+ l& _6 F4 r) S6 x

  77. * S# y7 j7 J  `: r
  78. static int acnt = 512;
    + U( D  R1 O) `8 a1 C1 q) J5 z
  79. static int bcnt = 8;, f8 \9 Q! R( {% n1 J( p
  80. static int ccnt = 8;  ?$ q  s+ @1 |7 b) s2 q

  81. , F9 a7 ?) C$ b0 C* x' t
  82. module_param(acnt, int, S_IRUGO);
      `- W% W# K; `+ U/ t9 x- X
  83. module_param(bcnt, int, S_IRUGO);
    ) b9 m6 Y5 R, b/ i: g* c: X8 y* A% G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 i/ P9 |# _" [  S. N7 s

( c) c8 E/ Z9 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* R8 @/ E- @( h' v; a% Z$ C  {- `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) G" Z/ |% e# j  {( X4 s3 }/ K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, B& i7 h2 t0 [# D1 S- t0 ?5 ^; }1 t* J& ^6 }; R# W* c7 M  W
* \" X* x8 O9 g* \% }& g5 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 07:33 , Processed in 0.049143 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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