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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ h5 S3 x9 a  g6 y+ a/ ?
  1. [code]EDMA sample test application
    / N% j: g! h3 F, ^( w
  2. /*
    : Y: E6 h1 C* L7 l4 _0 v& z
  3. * edma_test.c
      C" @( O" w+ D" H1 ~' R+ Y
  4. *
    : j# S/ E8 _2 Z3 m6 |6 s
  5. * brief  EDMA3 Test Application
    & s  y" S- F" Y* \
  6. *
    ; ]1 v. N1 [( T7 ^4 K+ }
  7. *   This file contains EDMA3 Test code.* H3 _; e- g' K  D9 |. G# ?
  8. *, ~1 C% T' V5 {' P: d- C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ d1 Q5 U3 V" D( {4 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! s- G/ R& ^& w7 g/ @0 G3 V
  11. *         TO CHANGE.* h( ?3 ^3 C/ U+ e
  12. *1 [0 x& n0 s+ P8 y. @4 L6 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 U3 O9 H5 M, r1 l8 s8 c: i
  14. *  Y6 z5 o! G! b4 d8 @) ]* s0 I- l  Z1 u
  15. * This program is free software; you can redistribute it and/or
    ' @* Q8 k) [  b2 r) ]2 v/ [( X3 T
  16. * modify it under the terms of the GNU General Public License as
    ( {6 W( E5 J4 f9 [( L
  17. * published by the Free Software Foundation version 2.* a$ p/ c% `& }
  18. *2 D0 b9 }7 B' u7 W3 L& Y5 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( w/ c7 ?- Q) h' T* f- Z, C9 N
  20. * kind, whether express or implied; without even the implied warranty1 P: I. J- t; p. G" s0 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / V- z- a% X5 y7 n4 g5 W
  22. * GNU General Public License for more details.' e5 R3 |& R/ H6 R
  23. */
    1 I% A/ d6 O+ q

  24. % _3 F0 j* T$ w" b- e0 U
  25. #include <linux/module.h>
    . t: l" Y' [8 C2 x/ k4 i
  26. #include <linux/init.h>
    + G7 A/ A1 B' Z3 R/ x( Y6 {
  27. #include <linux/errno.h>
    4 d& H$ x- |* m+ k. B
  28. #include <linux/types.h>5 K, w4 e9 q; m5 G- c
  29. #include <linux/interrupt.h>
    7 G( w% E( S: O0 k& z
  30. #include <asm/io.h>
    6 a% [' L+ t7 o% w* O, B' G
  31. #include <linux/moduleparam.h>/ a) l6 f7 c: f. C* |% v
  32. #include <linux/sysctl.h>
    * D$ Y1 t$ i7 `, a) q
  33. #include <linux/mm.h>3 l+ p1 X2 H* R5 `2 v, p
  34. #include <linux/dma-mapping.h>' f/ k  O! `9 z. Q# b% i$ z5 y

  35. # }. h7 D$ h% q5 `: `, t4 u+ H0 p
  36. #include <mach/memory.h>
    3 {- S$ Q  _' _) C( l( j
  37. #include <mach/hardware.h>
    * S1 }7 F) o% @7 S) G9 X6 D) \
  38. #include <mach/irqs.h>5 s9 W& Z% F, s: F2 b" o  k3 P
  39. #include <asm/hardware/edma.h>' Z* j! V1 ^0 }- ~0 T
  40. ; t+ e8 K3 c8 M0 u8 h, m
  41. #undef EDMA3_DEBUG
    ' e* U- G" B, Z& W, |
  42. /*#define EDMA3_DEBUG*/
    . C; h' z1 l1 S# |/ q
  43. 2 z( @: V% c% }+ X
  44. #ifdef EDMA3_DEBUG
    " F/ Q) K; y7 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 w$ P% a5 |' Y' m6 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): @0 r5 R" A! J0 u" m: h7 ~9 C; ?3 e* k" t) x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): q( d9 A. g1 I+ k4 O1 k
  48. #else# @6 D  m4 P7 y! l) P
  49. #define DMA_PRINTK( x... )) \  l  Q/ ^9 w; |  \. Q* }: x  w
  50. #define DMA_FN_IN
    5 t7 L# f/ P8 l4 d& b5 h# R
  51. #define DMA_FN_OUT
    ; M$ T0 c- T7 y, i( h" g
  52. #endif
    ( k6 J8 y5 u) O& D2 c# g

  53.   H, _3 w# l6 J+ c( N0 r7 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 [+ L4 S3 @' V- P9 d
  55. #define STATIC_SHIFT                3
    8 |8 c2 F( A1 x
  56. #define TCINTEN_SHIFT               20
    7 \( p% c1 ]) u+ `
  57. #define ITCINTEN_SHIFT              214 \) x9 A# V# f
  58. #define TCCHEN_SHIFT                22" Y# t" Y2 c  A& y1 s
  59. #define ITCCHEN_SHIFT               23% k+ D) {* Z, S% h
  60. " @6 i  K9 i: m) T4 U' Q, c
  61. static volatile int irqraised1 = 0;
    - ^' f! _* H5 Q; p$ `- E9 W  B0 w
  62. static volatile int irqraised2 = 0;7 t8 H' @0 B4 f9 n+ i

  63. $ s: M8 ]+ _# Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! k1 [& _* C& K( y/ \, D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; C6 d2 I4 M* k' C% |2 P  D& ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ?0 U- M: g& T9 F+ P' {
  67. 6 V# ^, M  B, {; U: F4 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    ; \+ V: ?4 P& w6 k/ w& }
  69. dma_addr_t dmaphyssrc2 = 0;& U* F4 a! ]( K* p; o/ @# f/ {
  70. dma_addr_t dmaphysdest1 = 0;. U! {% O1 M+ f  Q( u$ ^7 ]
  71. dma_addr_t dmaphysdest2 = 0;
    1 h- H- |8 R. ?8 {9 S4 T% ]: t
  72. / `; ?" j. [8 O* b- E0 k
  73. char *dmabufsrc1 = NULL;/ L" f2 ]$ o* g! g; N* n0 p& r
  74. char *dmabufsrc2 = NULL;
    3 B6 v* T3 {: ]2 Z) e' \: S; r
  75. char *dmabufdest1 = NULL;7 ?4 i+ o1 V& P; O4 z* H
  76. char *dmabufdest2 = NULL;- n7 V  U* Z5 K9 g
  77. 5 @. }; D$ V7 p( @4 w3 k' `* F
  78. static int acnt = 512;
    % X% w' z9 Z! D. |( p% M- k$ a
  79. static int bcnt = 8;
    - T8 I! i2 f& F; `
  80. static int ccnt = 8;
    . c9 Q& s2 v* s& j# L

  81. 2 T" T2 J. ^/ M) g5 t
  82. module_param(acnt, int, S_IRUGO);
    ! J& P3 H; Z/ p2 E: B% G, o9 e
  83. module_param(bcnt, int, S_IRUGO);
    / z4 H' T- `0 F8 b7 E4 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" `2 a9 F' \1 M; P
; W2 i' T4 U. K/ d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 f* v7 [5 d( P. |: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. g7 Y! k7 Y1 ]  a( h+ I. |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" H0 U- `( f: }3 P
" S1 O9 h+ u. h" i' L; w$ i  B/ Q: N2 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 07:07 , Processed in 0.040160 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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