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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ?2 t/ }8 o: h5 D
  1. [code]EDMA sample test application
    6 k4 J/ {) A" f0 a# l- V
  2. /*
    , G1 l/ a8 K7 n3 N, ?0 \# Y
  3. * edma_test.c( n4 o' f' ^) o2 x
  4. *# e/ f9 U( J" |$ i  ~$ A
  5. * brief  EDMA3 Test Application- U: f& G6 O( T1 P
  6. *
    9 u/ k; {& f9 f* k
  7. *   This file contains EDMA3 Test code.
    9 o4 v. Z4 Z0 g3 T2 W, l
  8. *6 b) f: L7 W; U' s; }# S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& e2 A; Y7 O; I- Y( p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / ~1 ]  B! [1 |; E1 o
  11. *         TO CHANGE.% w/ o1 _. A6 ]8 z4 H, ]
  12. *  E! D0 ]0 l. U, i4 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ]* n" S* h! M, Q" e! v
  14. *
    " B. F* u5 q4 B, E% Z
  15. * This program is free software; you can redistribute it and/or* J1 t- Y- ^/ Z) Z
  16. * modify it under the terms of the GNU General Public License as
    ; Z2 b# T: u1 {2 `+ {: H
  17. * published by the Free Software Foundation version 2.
    ) G/ n8 S# X4 s! N6 U
  18. *
    : n- M) e* v: z' P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 c8 l1 }9 D; M; W2 h0 `) b
  20. * kind, whether express or implied; without even the implied warranty
    : a$ g* E  u6 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ k" [8 g; k8 h5 t; i
  22. * GNU General Public License for more details.
    , F7 q9 E( k) @5 `' X
  23. */+ {$ d' W# T( m7 T6 F

  24. 9 T0 y, S: T0 V) _( n6 c
  25. #include <linux/module.h>; ?$ T( g  k2 C8 g
  26. #include <linux/init.h>
    : |# H% N  L- o' o6 |+ r2 Z
  27. #include <linux/errno.h>: q& w' Y9 U, W6 ]4 I
  28. #include <linux/types.h>( ~4 R- r3 X. Q. t8 k. \3 ^$ i
  29. #include <linux/interrupt.h>
    8 m% {3 P9 ^; d, U
  30. #include <asm/io.h>
    0 h8 \8 ^: ?0 h( T/ u
  31. #include <linux/moduleparam.h>
    7 P7 _8 N* }4 N4 t* @
  32. #include <linux/sysctl.h>* L3 l, D5 f# n1 k
  33. #include <linux/mm.h>
    + U3 t, ?% G# m, \0 X) Y
  34. #include <linux/dma-mapping.h>! h- B! u/ s$ Y' z4 @
  35. $ G2 d7 Y; v* h; z+ D! E( h
  36. #include <mach/memory.h># s! |$ h7 ^0 U- ^, {; N5 P
  37. #include <mach/hardware.h>
    2 r  [* m+ a6 p3 J0 F
  38. #include <mach/irqs.h>
    4 Z* }& A& R% T
  39. #include <asm/hardware/edma.h>
    $ V/ _9 s% G8 z/ E

  40. 4 e8 H4 @8 }- N
  41. #undef EDMA3_DEBUG2 L# i* x  \: ?
  42. /*#define EDMA3_DEBUG*/) P" p9 s% w6 x2 U) l1 z
  43. 6 V0 `: Y0 i) @# L
  44. #ifdef EDMA3_DEBUG
    ) v' l% }% P* y9 Z7 G" z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 `! t8 n) n1 j. u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). |9 ?8 i: d7 f' J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% r& ~: @( }* n  ~, G/ v
  48. #else
    5 n9 n/ q! @; r6 G  y
  49. #define DMA_PRINTK( x... )0 I# L$ Q7 i% a( U/ s
  50. #define DMA_FN_IN
    % [9 G. j( l2 q5 S3 o
  51. #define DMA_FN_OUT
    ( h1 x0 _+ c2 B# G" }
  52. #endif
    ( d! h: _5 _! W  {0 z

  53. - R8 ]* G* w" f% j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) Q& b. v% F* E9 A8 Y
  55. #define STATIC_SHIFT                3" m* `3 {( U3 o- H
  56. #define TCINTEN_SHIFT               20
    # A- _5 l4 v* k1 D
  57. #define ITCINTEN_SHIFT              212 A! o0 N: [& Q" M. w
  58. #define TCCHEN_SHIFT                22
    ( K2 A4 w6 F3 j  {$ _
  59. #define ITCCHEN_SHIFT               23- n- N2 x' D1 k/ S  q8 a; {& y0 X7 X

  60. + q; n) S. k  I3 w: B6 o( v& F
  61. static volatile int irqraised1 = 0;
    / [5 q, X0 d" Y! \9 G  a  u; Z
  62. static volatile int irqraised2 = 0;9 d. C/ G/ w# ]4 m" H2 }3 D
  63. % h7 C) |4 [% O# L$ C2 |% m4 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 a1 Q2 Y! a3 b3 {' g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # W2 D% b# @0 T! z# V- @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # Z; J8 z5 H4 s4 v( G4 F
  67. ! v0 S, p: q3 P6 ?& c7 k- {  k
  68. dma_addr_t dmaphyssrc1 = 0;6 |% j( Z3 m7 B0 ~
  69. dma_addr_t dmaphyssrc2 = 0;; S: w( z6 g6 p% s8 k. |
  70. dma_addr_t dmaphysdest1 = 0;3 o- i4 G  _# i
  71. dma_addr_t dmaphysdest2 = 0;( k" _0 j4 j5 E( I1 C
  72. ! F, h5 v: s( C0 S% O
  73. char *dmabufsrc1 = NULL;
    # a' ~( a1 x: u0 @& I
  74. char *dmabufsrc2 = NULL;
    2 R# P2 g9 o! H+ S9 R  W9 t4 Y
  75. char *dmabufdest1 = NULL;( ~  P. }& z- o" p* s5 x
  76. char *dmabufdest2 = NULL;  a( ~8 g+ K$ ~2 L7 y7 |

  77. 7 O+ ?# o2 \- }. H
  78. static int acnt = 512;
    / o6 s1 p- N. ]# F
  79. static int bcnt = 8;" r3 Z- K8 N$ d$ |2 i/ s
  80. static int ccnt = 8;, W/ h# S6 k$ d5 p9 g

  81. 8 d1 @/ o6 f: Q: B. @6 L- u) C
  82. module_param(acnt, int, S_IRUGO);
      F3 g4 ~- k7 |+ s) O3 u# p: Z
  83. module_param(bcnt, int, S_IRUGO);/ T$ }: C0 M7 P  Z: E, d( {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. y7 k. u2 C, `, O
! k' w* E" N5 L- Q( r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 w! Z' x5 q0 r- m4 r" D0 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* W) O$ o! V6 `  q( z6 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" C" U; T% N0 C( H5 `4 \& S% V/ [9 o6 j

- A: @& q5 g+ a7 m7 f+ T% Y, a# e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 19:43 , Processed in 0.052258 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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