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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 K; m' K- S) k; L) k
  1. [code]EDMA sample test application
    ' t: ^- o. f7 }
  2. /*
    9 V) {# O  T/ H- k* c
  3. * edma_test.c3 M' o! t7 [4 B' H) e
  4. *8 R+ Z1 ^+ _( H4 k( M
  5. * brief  EDMA3 Test Application1 R: S0 h2 g! w' c
  6. *2 f$ H; T' I5 ~9 G6 ~1 @, t
  7. *   This file contains EDMA3 Test code.; P! L$ R  r7 b: O9 j. L1 o& u
  8. */ M* J, E& g# G. C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + P$ r) K# }! B  e5 ]7 i" d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; C& F; H: T5 `% r6 t
  11. *         TO CHANGE.
    ; K# }0 c! w3 H/ z- N& B/ M" ?. G
  12. *
    3 e+ I5 I" j. J5 s( |: w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - F0 h0 y7 K- l! b0 h* ^
  14. *
    1 w1 S4 P; C% ?, l- a4 m) Y
  15. * This program is free software; you can redistribute it and/or9 t8 x- G8 b# D. [
  16. * modify it under the terms of the GNU General Public License as
    1 d7 a) y( ~0 r) w  @' h
  17. * published by the Free Software Foundation version 2.
    1 _9 |8 i* c" [& |. E$ {
  18. *" v9 g3 u3 B: A7 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( g" s+ D/ L9 ~( i7 w. h. N/ `/ x
  20. * kind, whether express or implied; without even the implied warranty$ G& M6 @$ r4 u( x9 a  i3 E* r- w& _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 l/ N% G' ~. j  _% n. o5 ]$ V5 |
  22. * GNU General Public License for more details.  N! I1 J; Q5 l: C
  23. */
    : r( Q3 I/ N/ f' l' u
  24. ! O/ n: v% b# s, W
  25. #include <linux/module.h>
    6 V: d5 V6 B1 @, Z. G- j5 e# B5 z
  26. #include <linux/init.h>
    ; o- @; ~; x) |. h
  27. #include <linux/errno.h>+ H( c) ?6 r6 \1 p0 `4 Z. P( L) E
  28. #include <linux/types.h>
    ! [: ^0 |9 X7 q+ n5 L# r, v( \0 H
  29. #include <linux/interrupt.h>
    $ \: n1 l( ~* U, e* V( c% t
  30. #include <asm/io.h>0 O' e: D. a: j: A- k
  31. #include <linux/moduleparam.h>/ i% G1 n/ {/ e5 D4 C1 h
  32. #include <linux/sysctl.h>
    # j4 W3 {# z& O$ C3 f  N
  33. #include <linux/mm.h>
    : R' R$ |( g" `; D, N& r
  34. #include <linux/dma-mapping.h>  O$ |, t: c+ H
  35. ) l3 ~# P9 O; C
  36. #include <mach/memory.h>1 v3 R1 ?! A. T7 d
  37. #include <mach/hardware.h>: _3 h$ W' {4 a- h, R+ d
  38. #include <mach/irqs.h>, Z3 Y( r5 O3 {; T3 D
  39. #include <asm/hardware/edma.h>8 z! C+ j2 n6 s+ @

  40. 6 m( J' d4 ~- \, A; a
  41. #undef EDMA3_DEBUG
    1 s( u- m$ s; P1 f7 H6 u4 f0 v
  42. /*#define EDMA3_DEBUG*/
    ) S+ f  F, v  f! Y0 H$ u
  43. ; e: d& c! H  I- I0 k2 N
  44. #ifdef EDMA3_DEBUG* m9 Y* M! B. \3 u% s$ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 @( ?% O5 }; V% }4 v, T( f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ u5 T! }0 R- ^( O* O* y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 t8 Z( q) z5 S5 t0 u9 n
  48. #else, x+ \, N4 F3 l: q1 Q
  49. #define DMA_PRINTK( x... )
    . B6 r8 x& ?$ A: g# Y- g  d5 M* v
  50. #define DMA_FN_IN
    & L: J2 {7 O) h2 v$ s
  51. #define DMA_FN_OUT
    4 d. }0 s0 k' [1 H5 I6 s
  52. #endif! x! t* F: d8 g( A( r

  53. . T  Y$ I$ c( |# [9 R% s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 e) F  \% E$ l2 [# @5 e
  55. #define STATIC_SHIFT                3. o8 Q5 V- [, q. V. A" I$ `
  56. #define TCINTEN_SHIFT               202 w* D7 ~: a# `" k& a
  57. #define ITCINTEN_SHIFT              21. R% c7 M# w9 c; Z$ P8 X
  58. #define TCCHEN_SHIFT                22& S- j! A, o9 ^
  59. #define ITCCHEN_SHIFT               23
    ' Z7 l8 ~0 E( l6 R7 j$ ?) x* P
  60. 4 B- x, D' D4 Q1 [) f
  61. static volatile int irqraised1 = 0;; d6 m' e- Y7 M
  62. static volatile int irqraised2 = 0;' i" W) a/ p4 U7 w0 E9 j

  63. 2 Z2 w, f, B( K( c6 ~# B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u& Y: g0 w7 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {; H/ f" W$ h, T+ f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , p; `) q# T* E7 x+ E" I) y* F/ g

  67. ( y) {  F, C+ {$ i+ ~2 l, b7 w2 `/ n
  68. dma_addr_t dmaphyssrc1 = 0;
    6 i( v& t- @6 E# c
  69. dma_addr_t dmaphyssrc2 = 0;
    2 T; A( O9 F+ I/ i) V' R' q
  70. dma_addr_t dmaphysdest1 = 0;
      s$ v! L" m. o$ }! H+ [
  71. dma_addr_t dmaphysdest2 = 0;
    ' y: B0 {3 s% _/ M( i. N9 o

  72. ) n* z" e& P* h3 ~+ i0 y
  73. char *dmabufsrc1 = NULL;
    5 E, P" D: i% i. g
  74. char *dmabufsrc2 = NULL;
    4 Y$ V' `' Z( j& l
  75. char *dmabufdest1 = NULL;, |7 g. h" B: P  |( P
  76. char *dmabufdest2 = NULL;
    $ b0 x  w4 p- C
  77. ' n! A+ g0 y+ m; t
  78. static int acnt = 512;# K. s. B& ]: ]9 R" P( j/ |. S
  79. static int bcnt = 8;
    9 R+ [. _+ |. _. G8 t) [
  80. static int ccnt = 8;  D! F# _- G% T5 G

  81. . C4 y+ c' e% \7 ?
  82. module_param(acnt, int, S_IRUGO);
    3 d. W, O8 J0 w; q7 @( ~" o
  83. module_param(bcnt, int, S_IRUGO);
      y6 L( \# U: |+ h6 V1 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 o! g) ^- C: T6 l" v9 O  Z; O6 Y5 S. e; m: u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  j2 P) K  v! P# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. a1 i: Z7 b! T$ d& j2 K) K5 H5 k! m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Y+ R8 c  j& i+ ~' |7 H1 Z' ~* _
! f/ L# D' }* `8 c1 Q

" s. n0 i! a2 I: T! p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 09:01 , Processed in 0.039897 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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