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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 i9 a; X' j5 P; }; E: q
  1. [code]EDMA sample test application: c2 l* ^) r1 g) s" ]* \" e
  2. /*5 n" S' y6 m: K' v% k; V
  3. * edma_test.c
    % C  K7 K4 h/ E/ U1 ?( u( h2 F
  4. *+ R5 G4 I+ Q# G# a
  5. * brief  EDMA3 Test Application
    1 J: W* y/ w( F- K; Z/ k" p
  6. *3 ^$ V) S4 W- `7 e
  7. *   This file contains EDMA3 Test code.7 \  A1 }, x6 m- `% A
  8. *; ^$ J/ \! \: t/ b. o7 {2 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 V6 W( \* F9 |) a6 n/ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & K; F4 Y' i9 \8 A0 q2 ^
  11. *         TO CHANGE.6 }! T8 |; L' F, j% B/ F, i. K
  12. *6 {# V% i7 Z4 n0 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: p0 {0 j( ]( d; I9 K: `) A
  14. *: X; N  ^9 D+ l7 ~
  15. * This program is free software; you can redistribute it and/or
    7 [8 h, r* y6 Y# A% J) B& n
  16. * modify it under the terms of the GNU General Public License as6 s* u) R% D  w+ N+ q
  17. * published by the Free Software Foundation version 2.. d0 S0 x* ^, `0 L! [1 v" v
  18. *
    6 D, Z  f# y( I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , |1 T6 k- S. r9 [
  20. * kind, whether express or implied; without even the implied warranty9 r" E. F; \' [0 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, h! o  N) \+ @2 s# L# D( f
  22. * GNU General Public License for more details.
    6 H: d+ |1 j6 {
  23. */
    ; q% N0 b5 a+ m

  24. / }: O4 \9 R9 `2 y/ C9 M% S
  25. #include <linux/module.h>' v6 ?% O0 Y! N, A
  26. #include <linux/init.h>  l5 v! H& f  h" G0 Y, ?8 k
  27. #include <linux/errno.h>
    / q- d1 h; c( L
  28. #include <linux/types.h>
    & y: S7 L  i# f& `2 e. l  k
  29. #include <linux/interrupt.h>9 P: a8 L6 k4 l$ O
  30. #include <asm/io.h>
    " {9 b0 P3 S* @2 j4 M
  31. #include <linux/moduleparam.h>
    7 B2 G/ i+ _( p9 \, |( k5 U" o
  32. #include <linux/sysctl.h>4 ^& }8 n  L( T% ], x4 p
  33. #include <linux/mm.h>) @0 Y4 S5 N, K1 v( V
  34. #include <linux/dma-mapping.h>
    & Q8 g5 q6 d6 S9 |

  35. 8 y6 v4 Q0 ~! N# i, D1 V
  36. #include <mach/memory.h>
    4 [& o" q/ ?( u1 f( b4 l% R
  37. #include <mach/hardware.h>8 m) Y* L- k0 B
  38. #include <mach/irqs.h>
    % p' _& O8 W, @2 s3 }, P) X
  39. #include <asm/hardware/edma.h>
    . p) M4 U0 J7 j* P- _/ n9 A
  40.   _# K: R' E4 O9 T  Z
  41. #undef EDMA3_DEBUG! q5 V' n  C, B# K
  42. /*#define EDMA3_DEBUG*/+ y# g# R) |; w6 `6 d+ }1 Q
  43. 5 G* N( u; G& j: g4 J; E* T- T% L
  44. #ifdef EDMA3_DEBUG
    0 X5 g4 \5 _: l: u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ P8 ?+ f$ m6 S, a$ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      f& |' V* S0 g7 x9 a0 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; s; n, x9 z8 {% V
  48. #else
    1 M8 W' ?, ^# m
  49. #define DMA_PRINTK( x... )
    " x' Q, P. s: y# k3 x
  50. #define DMA_FN_IN5 W8 a, E* C8 s
  51. #define DMA_FN_OUT
    - W5 k- |. X1 M0 h8 R) S' B
  52. #endif! b! [, }9 L4 M" c6 i# S5 [
  53. ! r8 o3 f  K' M  N  ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 k( @" P3 [( o
  55. #define STATIC_SHIFT                3- P7 ]8 ~) ]% ]
  56. #define TCINTEN_SHIFT               20) M1 g( i  E+ e6 Z1 {
  57. #define ITCINTEN_SHIFT              21
    $ N+ M$ f9 O! M( I
  58. #define TCCHEN_SHIFT                22
    ; D0 l  T4 z; W5 c
  59. #define ITCCHEN_SHIFT               23. f) F. b, B* X5 |9 H
  60. ; ], \" I; Y  n. L0 E# u
  61. static volatile int irqraised1 = 0;9 y1 E# K, w8 L" t3 d. g- X$ [
  62. static volatile int irqraised2 = 0;
    $ t1 h: s8 i7 L) T( Q- b6 Z
  63. 2 w- s* G/ K& E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w; P2 F+ q% \; j9 X# h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 T* \: e# A7 P) e8 Q4 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 X) B2 ^# n0 Q
  67. 8 ^* a$ V! S4 g  {$ {' r
  68. dma_addr_t dmaphyssrc1 = 0;1 n2 _& R  x2 I" J2 a, j3 Z
  69. dma_addr_t dmaphyssrc2 = 0;9 G# ~7 K! o2 J$ e/ M
  70. dma_addr_t dmaphysdest1 = 0;2 M. z% x& D8 s( r! {* [% O
  71. dma_addr_t dmaphysdest2 = 0;1 ]; U# p8 Y) ?4 k/ w& N
  72. % d8 Q& l' ?3 \' z) V4 n
  73. char *dmabufsrc1 = NULL;; j9 L  d0 M9 f1 Q
  74. char *dmabufsrc2 = NULL;! `0 W/ p. i/ }" o6 n' n/ d+ U
  75. char *dmabufdest1 = NULL;
    " J" W4 @3 O6 C. ^& D3 ^
  76. char *dmabufdest2 = NULL;
    - T( c+ N' O- I$ d/ F( |0 o/ [2 P

  77. & r, l" ^5 H  o% D- B% a
  78. static int acnt = 512;& @) z5 Q; j- g
  79. static int bcnt = 8;
    & e3 i- A5 G7 ]8 }; a$ m
  80. static int ccnt = 8;6 s- O7 I6 O" G: y, N8 M

  81. 8 h" G% v* G* P  T+ E  `5 k
  82. module_param(acnt, int, S_IRUGO);+ H% l0 y5 w" s0 }7 A3 j
  83. module_param(bcnt, int, S_IRUGO);
    7 Z7 F6 @( H0 A7 B3 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( ~3 ~9 G! ]) O" r8 j
$ l* r. _# E. F+ S$ Z" j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 Q, m. G0 c1 s, O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- `) j7 I" D0 k" _! U4 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) N* z! _5 V8 g) t( u5 U$ F
# T3 S8 o3 b0 U7 x) c5 Q+ `
5 d+ i5 m! g# `. n/ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 17:23 , Processed in 0.037303 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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