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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . O7 b' |7 ^; n' H/ F2 g
  1. [code]EDMA sample test application. r( D! o/ Y! L- g
  2. /*
    6 s( _1 L6 x! @  h$ Z$ G- c
  3. * edma_test.c, y7 g+ c" U+ K
  4. *) U2 @. @7 ~, }! R2 D+ M, z
  5. * brief  EDMA3 Test Application, q" @# ~4 s, ~$ j- }' @
  6. *- S5 b6 G1 y* A, a" b1 b; K2 Z
  7. *   This file contains EDMA3 Test code.
    $ i( ]# O) a( o# u
  8. *
    2 {: i2 Y& N6 y5 d9 T& t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / z5 E2 e9 s. M2 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : c: c/ S; |! O
  11. *         TO CHANGE.: w6 O2 U" J9 B3 O# n* t
  12. *! h* ]* ]+ n4 W# Q* r- x# n) t3 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' }% Q' J" R) y
  14. *  o1 Q4 t6 a! k+ O
  15. * This program is free software; you can redistribute it and/or
    / E1 g9 r6 o6 s
  16. * modify it under the terms of the GNU General Public License as3 f$ f, S* J2 i) R, @6 }' B; u4 @1 }
  17. * published by the Free Software Foundation version 2.- E9 u- p  L1 \1 X
  18. ** U7 @( M) Z- m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  _% M6 ?8 V/ ~
  20. * kind, whether express or implied; without even the implied warranty1 e5 l9 @" V. l, z$ s; n. q; z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& ~& X) A  ]9 H: j/ V9 h6 N  h
  22. * GNU General Public License for more details.
    * U- X$ N, ^; g9 }: c9 [
  23. */4 ^  Q1 S4 _' l9 a
  24. . |, c# F; f! m1 }$ M: B! U, n/ O' M( `
  25. #include <linux/module.h>6 Z! y2 v) Q; \$ V
  26. #include <linux/init.h>
    ) T# N. C4 r" s
  27. #include <linux/errno.h>
    & I  U4 r5 g1 {- q2 j4 a
  28. #include <linux/types.h>
    5 E* k# @7 T2 F4 O3 C& r' S. h) n
  29. #include <linux/interrupt.h>
    ; g. S4 N2 z) s* [+ j) Q
  30. #include <asm/io.h>+ T1 P' V( i) @8 ~5 B3 u0 w
  31. #include <linux/moduleparam.h>* S- N  r: y5 K9 @2 I$ @0 S
  32. #include <linux/sysctl.h>
    3 _9 v/ ~5 Y9 c* [5 Q& S/ K
  33. #include <linux/mm.h>% Z8 z* y8 U+ W  @- I6 U
  34. #include <linux/dma-mapping.h>
    ) H3 h9 x8 q  L4 X$ t

  35. $ Q. B* v/ v* b0 ]  T: c
  36. #include <mach/memory.h>$ x& Q: J9 P6 c. Q2 u
  37. #include <mach/hardware.h>
    ! x$ `8 N. V8 B) n0 [* L
  38. #include <mach/irqs.h>
    # z# r/ y6 Q( W+ S
  39. #include <asm/hardware/edma.h>8 H& d$ W5 s& y+ x" |0 ~( Y. [, I
  40. 4 {& A, {* U" Z7 z  [
  41. #undef EDMA3_DEBUG
    & K* z0 I, F- a
  42. /*#define EDMA3_DEBUG*/
    8 c- \4 g7 g& e
  43. 9 l$ |9 t3 o/ c- \4 b; X' P4 M
  44. #ifdef EDMA3_DEBUG
    & u4 Q6 M6 N, U. A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- o7 T  x3 w9 f; p' @- A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). q6 N3 h; M  R% F0 m) H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ U' P1 V: V  J$ q, c- j
  48. #else
    ; @+ m9 D* x2 j# u! W  P  R/ F
  49. #define DMA_PRINTK( x... )
    4 g- R; W0 D( i8 V+ a. H
  50. #define DMA_FN_IN
    ' X* a- }# J! a! p/ f6 {
  51. #define DMA_FN_OUT
    2 C8 A/ [8 U# d. \$ V/ [
  52. #endif1 F. T9 J' W+ V; v* k# ]+ o

  53. - q# u( b1 {2 i# t! g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), K, k0 R0 N- L# a4 S
  55. #define STATIC_SHIFT                3
    - x! H3 [+ f3 o' E4 z
  56. #define TCINTEN_SHIFT               208 I  Z$ K# `; P- O  H1 M
  57. #define ITCINTEN_SHIFT              216 V" j' O( f5 `: _
  58. #define TCCHEN_SHIFT                22
    # X# E- f0 N, A+ Q3 k3 C
  59. #define ITCCHEN_SHIFT               23
    7 \! b! O* g1 s, K6 a& i

  60. 5 ^* Z3 N' y2 `
  61. static volatile int irqraised1 = 0;- z, N3 o. {, `9 P' \# ^
  62. static volatile int irqraised2 = 0;
    ' N( y6 \& Z6 m7 O

  63. 6 x/ M: {8 y& B' e' \& @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# k, {; b' y9 I* u9 g! B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ?! k' \# _7 r. e; S% s6 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  M3 c0 Y8 o% K; D# u# J! L
  67. 8 g$ k0 q; T9 ]6 o5 S
  68. dma_addr_t dmaphyssrc1 = 0;
    / [1 y7 U0 p* C& u
  69. dma_addr_t dmaphyssrc2 = 0;) F' L# Y- w8 T9 `
  70. dma_addr_t dmaphysdest1 = 0;
    ! i" Z4 C5 a( F) R# Z! w
  71. dma_addr_t dmaphysdest2 = 0;* Z( d8 F& }3 d
  72. , x6 z" @& k5 D% E# z
  73. char *dmabufsrc1 = NULL;
    $ o1 M% {  o$ X1 p/ a
  74. char *dmabufsrc2 = NULL;
    0 A5 f  J$ K: c3 X. v
  75. char *dmabufdest1 = NULL;
      }& T. q5 E3 B: g
  76. char *dmabufdest2 = NULL;
    8 z  X  u% T. G+ ]4 Y

  77. - `% V, {# j1 [) ?7 {
  78. static int acnt = 512;
    8 d( c$ S  y, T1 }6 V7 E$ y$ _$ K
  79. static int bcnt = 8;
    4 q" I/ K9 A- K& S9 D! X
  80. static int ccnt = 8;
    ) ~# W) r3 ]: E- U4 w0 X& u& ~6 m. p
  81. 2 b, }2 X9 O3 _% q  {
  82. module_param(acnt, int, S_IRUGO);9 A9 d2 Y! V6 A- ^1 l
  83. module_param(bcnt, int, S_IRUGO);
    1 _$ D0 W& W+ x1 s; [7 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ U8 l7 J9 T6 p8 u+ R4 Y3 X3 u1 j1 d0 O1 U9 H* E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& l4 ?* {. @4 u. ^6 K1 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# r  T8 T! p$ j  K  N* E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, L; w/ `# N5 c+ U1 `3 a
: }5 _8 G  M6 M) W

, M9 U* I2 f$ K3 p! t3 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 22:43 , Processed in 0.038824 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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