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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 m/ x( |5 `- M: d3 V0 t  `
  1. [code]EDMA sample test application+ r+ U4 g* l/ r
  2. /*1 M! x) s$ y% x- X% D0 n1 x6 J# P
  3. * edma_test.c$ {* _* S& \- G5 n# L4 R
  4. *
    0 m: s: ~0 d( n" U- c0 p6 Y
  5. * brief  EDMA3 Test Application
    % m6 v3 |3 B' l0 m- E
  6. *
    & f0 i4 J6 g2 J7 U& x8 i
  7. *   This file contains EDMA3 Test code.3 w& N9 Q9 ~9 F: C" I
  8. *
    ! X0 ^$ G0 y/ i" J  R9 F) y0 R& F; [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 O1 f) C4 K2 X3 X" R) W5 J: |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 R3 g/ g6 q+ G2 k
  11. *         TO CHANGE.
    : J0 P  e4 k* Z& a4 l
  12. *
    8 B) U: l4 _) w; m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + M' l; c- ]2 Y2 G. r6 {  N* G4 l
  14. *
    % K9 Y5 e3 p' O4 Y. F; A
  15. * This program is free software; you can redistribute it and/or
    - {' j# B+ o9 W( i
  16. * modify it under the terms of the GNU General Public License as- H$ I1 q& n, C9 k5 K' x7 a/ l
  17. * published by the Free Software Foundation version 2." \( o5 O# a6 V: k: v
  18. *: w8 N, @- e; E8 J$ J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ w) Q" N1 X5 M% P- `" P# U
  20. * kind, whether express or implied; without even the implied warranty: p6 ]8 O/ ~" ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 q/ f( l0 {3 h7 r7 Y# {
  22. * GNU General Public License for more details.( l' e" ^& n) l4 D, f
  23. */# K" @2 d* j/ U) N$ L
  24. . x3 {/ A/ Z; C3 O( A/ ]
  25. #include <linux/module.h>- T8 J; N! X' B' C5 v7 O& O9 n; J9 W4 A
  26. #include <linux/init.h>
    : Y; U3 f0 U0 `
  27. #include <linux/errno.h>
    - j1 R: Q- _( Y4 g- N- @4 T0 g
  28. #include <linux/types.h>
    2 G, O) I; F! u) G5 b! b
  29. #include <linux/interrupt.h>
      @0 x! t" T1 ~( U, A5 l+ X3 ?' P
  30. #include <asm/io.h>
    : G- i( J2 b; N5 K9 e6 ^
  31. #include <linux/moduleparam.h># f; D: Y5 ^2 @  x" R* B( r
  32. #include <linux/sysctl.h>! f8 D: t6 P% e' y. ^6 x+ D9 [
  33. #include <linux/mm.h>4 M) G8 l2 [# t
  34. #include <linux/dma-mapping.h>* E" @2 Z' F" c: |& \% o2 s* d
  35. , a7 A$ H: B: Q. [- W( J
  36. #include <mach/memory.h>7 }/ r6 M/ L/ O& @
  37. #include <mach/hardware.h>! b1 [& d- X/ G5 w1 g
  38. #include <mach/irqs.h>2 I4 S# g" i# c2 |
  39. #include <asm/hardware/edma.h>
    8 c6 v  O3 a: H& j- b
  40. 2 ?  M* |7 q, {9 u1 I& I2 m
  41. #undef EDMA3_DEBUG
    4 o: j7 l, T) @* G1 R( t
  42. /*#define EDMA3_DEBUG*/
    5 @6 _3 w: \4 C/ [

  43. $ E: b2 ], p- W: |% F- O2 l: d  [
  44. #ifdef EDMA3_DEBUG
    / W' Y* n+ M4 A; M" E% [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . w/ d. P$ O/ f, l( r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " j6 w6 m- S5 B" v+ D0 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; g- w6 ^! }% P& N2 a5 x2 e
  48. #else6 d7 A$ P5 R1 Z
  49. #define DMA_PRINTK( x... )
    7 d9 N5 b3 u: \- s1 ]) L  h+ L3 `) F
  50. #define DMA_FN_IN1 B/ K' w3 ?6 K
  51. #define DMA_FN_OUT% p+ P5 M8 f5 ~; `
  52. #endif2 y5 a7 p9 ~) e, {  ]& v" ~/ L: Y; n, z

  53. * c- x( y* {  z7 h( ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 s7 H% C4 H# M! \
  55. #define STATIC_SHIFT                3( u) \+ B4 E6 ~1 ^* T
  56. #define TCINTEN_SHIFT               201 L( F9 J, R: b" [5 c& S
  57. #define ITCINTEN_SHIFT              21
    6 F! C( ]( ]; F: e- X
  58. #define TCCHEN_SHIFT                22) P* Z2 L! }, q& a; j3 C
  59. #define ITCCHEN_SHIFT               23
    & O) a* ^' c7 M2 P1 u) S# {
  60. 1 L6 d( i5 [" r
  61. static volatile int irqraised1 = 0;
      B3 Y% h1 }- c
  62. static volatile int irqraised2 = 0;
    3 l7 ~. n$ o: |! x7 ~: y4 y

  63. 4 \7 P6 \3 a- o% L6 c0 H- S6 a" v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  E5 d" O2 X2 o5 l7 c3 T; c2 y- |% J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: t2 H) c( z7 }- F' @9 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 T  N! v8 T9 J# m

  67. + H* Q7 Y$ K9 p% [; o& d2 N
  68. dma_addr_t dmaphyssrc1 = 0;) g0 X9 O% `+ i" j/ W
  69. dma_addr_t dmaphyssrc2 = 0;
    ) r" S6 t; e3 {9 ~
  70. dma_addr_t dmaphysdest1 = 0;
    ( ?5 E" w+ s. l" h5 J
  71. dma_addr_t dmaphysdest2 = 0;( \: ^4 F% I3 F# u4 y0 n5 s
  72. + |" N* V/ o2 C  {
  73. char *dmabufsrc1 = NULL;
      A5 R9 F. s1 D3 V% [$ q; p
  74. char *dmabufsrc2 = NULL;
      W: b- n! Y1 N( B, P
  75. char *dmabufdest1 = NULL;
    5 B! l0 |6 {9 X+ y
  76. char *dmabufdest2 = NULL;. T4 K6 W( v# s8 w! m8 |  A& s4 F
  77. 9 L) V; ^4 l. f1 j2 W7 n. L4 d; v5 O
  78. static int acnt = 512;
    $ {9 @1 t9 A+ n9 [2 o3 c% h
  79. static int bcnt = 8;
    * {! R& n( W$ q# c
  80. static int ccnt = 8;# ~8 C% k$ _: r" H7 g
  81. 0 s2 Z6 V9 [+ _5 X; n
  82. module_param(acnt, int, S_IRUGO);
    3 T# E/ i2 U6 e8 F& }  I" s: \
  83. module_param(bcnt, int, S_IRUGO);
    5 t7 y. S1 K+ j3 v" C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: ]9 V7 Z8 {4 K9 |  ^1 U* z  y9 L% y

. z: {9 |# G. G$ `( Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& f( i8 v/ W/ d& J6 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 Z; w; T8 r7 x& o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 x- `% v8 D* a5 u& Q0 r' b2 ^% m2 ^. ]! ^) O( @$ x& J

- i, s& y. [- ?* @4 }8 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 12:17 , Processed in 0.038977 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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