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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , b( p8 ^! E( k) E8 F4 @: u
  1. [code]EDMA sample test application
    9 s. q: d  g' @* m' D
  2. /*6 ?5 M6 O- P! i% j
  3. * edma_test.c
    1 P. f8 m+ S9 I% Z* g9 y9 w' f
  4. *- f7 ]$ ^. [& \% _$ Z! N
  5. * brief  EDMA3 Test Application: ?1 T' C9 O2 G2 e# F$ W
  6. *
    / p$ `4 M. Z8 B, A; r. H$ L, ?
  7. *   This file contains EDMA3 Test code.
    & m% E% J) ]3 `& K6 v( e2 Z
  8. *
    - }. w4 H/ P" ^, @% x7 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 b. T/ x; ~( W% m2 m$ g' V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 g3 I9 j2 J9 A# R5 V/ ^
  11. *         TO CHANGE.
    & z7 _% C7 A- d( }  W
  12. *2 J/ ]+ P9 Z8 e5 `' M  z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 P) b3 O9 r% t; h/ a2 v/ D
  14. *
    8 K/ s2 H7 A/ v2 O2 }
  15. * This program is free software; you can redistribute it and/or7 i& t; M9 {0 q- k1 `
  16. * modify it under the terms of the GNU General Public License as
    ) y* G3 u) M3 g: w
  17. * published by the Free Software Foundation version 2.
    ) r4 W4 T) @" U2 M2 D  K
  18. *2 m: j5 r& V5 T' ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 u' ]9 l% m- N! e
  20. * kind, whether express or implied; without even the implied warranty
    7 |  R% U/ d  t( u: y$ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) }$ a# w0 r. {3 z+ F
  22. * GNU General Public License for more details.$ @0 b8 D* o( Z2 ~5 U2 r
  23. */' r' w2 @# y1 L2 E' ~9 K: V

  24. " b: Q" C4 N, e# ~4 w
  25. #include <linux/module.h>
    - R- R5 }  {5 G' A+ Z
  26. #include <linux/init.h>
    0 L3 c0 K, Z$ i2 v3 U7 y' R" b; |  a
  27. #include <linux/errno.h>
    + P' G+ o$ c  ~1 Q2 t: ~: P+ ?& n0 o# N
  28. #include <linux/types.h>0 _! \# Q, Q! D# p
  29. #include <linux/interrupt.h>; ~$ @* q2 w' k; u. e9 X4 b
  30. #include <asm/io.h>+ s/ |) R# y' i& J2 a7 O  F- [
  31. #include <linux/moduleparam.h>4 }" i5 I" Q4 U3 V5 c; J% i/ U7 Y
  32. #include <linux/sysctl.h>
    3 M2 p) Y8 r* N9 i: B
  33. #include <linux/mm.h># A* f' [' Y4 x: l
  34. #include <linux/dma-mapping.h>
    2 O8 W3 b, U0 ^* f% N# l$ j
  35. : c+ t% r  J$ }5 i/ x. `+ b' ~
  36. #include <mach/memory.h>. P" t6 \/ o( U3 d/ X
  37. #include <mach/hardware.h>7 |& c7 B) [& A) l2 Z$ O4 k
  38. #include <mach/irqs.h>/ P2 h: @9 ~, e7 U4 b6 D. t) q
  39. #include <asm/hardware/edma.h>$ d) [/ v0 }: F. U' ^/ _+ \) ^
  40. , D* K( z* U" S" N% b
  41. #undef EDMA3_DEBUG
    0 d! \9 {) c. {$ n' N$ E6 Z/ I8 ^
  42. /*#define EDMA3_DEBUG*/
    ( e; I2 Q+ ^  N; S
  43.   `% A5 Z+ }: K) b: i
  44. #ifdef EDMA3_DEBUG
    : T8 q% q+ S% e, V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ^1 e; q: N8 {3 m& B! t. B  I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) J9 L* O; n3 r7 K: E/ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 L+ h: f/ {. E3 A* r0 R# F
  48. #else- X* Z8 {6 m6 R% b
  49. #define DMA_PRINTK( x... )
    : C; D. V6 n6 X1 l% x# t
  50. #define DMA_FN_IN1 Z* X# [. i( [$ N9 G5 L
  51. #define DMA_FN_OUT
    6 M& H1 u$ v5 x1 z% E; J" p
  52. #endif" t' x' s) X  n' c5 A" b3 y

  53. , G4 I& T; }8 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * V+ Q% J# I1 X0 Z& r& p/ b
  55. #define STATIC_SHIFT                3( I, `6 U: K2 X% ]7 i
  56. #define TCINTEN_SHIFT               20
    ' `  w5 d3 F9 `/ I6 v
  57. #define ITCINTEN_SHIFT              21( s% j4 F- Q( X6 P
  58. #define TCCHEN_SHIFT                22% ?) D1 `# H0 w$ L# n
  59. #define ITCCHEN_SHIFT               232 D0 n6 A/ A2 R5 d/ W

  60. 1 j) l: `, f, e) W! F3 X
  61. static volatile int irqraised1 = 0;( [* {" I& Z6 ~  a+ A
  62. static volatile int irqraised2 = 0;
    2 b& q9 I; ^+ A; k

  63. 7 Z3 Y/ G! ^" O, ~' l! X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# t+ {; Q# L( o8 A, L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ^* J. E2 _( }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I. \9 ]( b& z8 H+ J

  67. 0 B$ z) T- H6 _9 A: M* o
  68. dma_addr_t dmaphyssrc1 = 0;* u( n' j! E. o. p4 u0 F
  69. dma_addr_t dmaphyssrc2 = 0;
    2 h0 W6 H6 b9 w/ _3 `: Q* }* H
  70. dma_addr_t dmaphysdest1 = 0;
    $ q7 u: W7 x; {9 }: B" ^
  71. dma_addr_t dmaphysdest2 = 0;
    2 g, n( w( J& i( H6 Q! D
  72. $ i0 |* H3 x( E9 u
  73. char *dmabufsrc1 = NULL;
    7 n6 P; i5 h* z9 C4 m
  74. char *dmabufsrc2 = NULL;
    3 y: w# N( T1 S* [5 ]
  75. char *dmabufdest1 = NULL;
    ! |2 Y$ [, o" B0 ]( O
  76. char *dmabufdest2 = NULL;1 {" G* x# u& y& G
  77. % E& o: C9 e% ~/ \
  78. static int acnt = 512;
    0 j3 S7 N, g2 G" M( d5 T; z
  79. static int bcnt = 8;  w0 F! o: p% [; _
  80. static int ccnt = 8;0 ]5 ]3 O. h* o4 h1 y2 C

  81. 4 W- A4 U! p; g
  82. module_param(acnt, int, S_IRUGO);+ r! T8 b. u3 n% z
  83. module_param(bcnt, int, S_IRUGO);  D4 I- f% A# r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 j8 G, O: g% R* k2 Q" G2 B7 y6 q' ?( k4 f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 i0 k( K3 G* z0 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Q. ~$ W" ^+ N5 w( L, r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ]& `$ Z2 f$ R4 X; ~+ t. D3 G2 n
8 }- d2 v" Z* |3 s8 b+ Q* v

9 P4 z& o7 N5 ]0 ?' k! K0 M( U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 07:05 , Processed in 0.039349 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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