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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ L) l) R5 `' Y& N' n
  1. [code]EDMA sample test application# j1 {7 t: S+ A6 B- w
  2. /*
    ) h% Y# J  p' V3 Y
  3. * edma_test.c
    , F: z0 _( o8 B& _- w3 r: U
  4. *
    5 a+ e2 O$ K- E3 B" D2 h
  5. * brief  EDMA3 Test Application! o5 j! z# F/ B, B+ ]
  6. *( a3 t; C/ P+ Q" b/ g5 C& }# j
  7. *   This file contains EDMA3 Test code.3 {! c; c# d, i& _
  8. *
    , f( B9 ^' {) W: k* D% _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : T4 z$ q# Z$ j  W, Y- p) n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; O" X$ B- h$ j3 y% M/ H0 D3 y: j
  11. *         TO CHANGE.: O; V- U: B9 _( L) F+ A- v
  12. *
    ) n; f9 n) T: ~* Q0 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 o( y+ c4 s$ s  g! A# I/ `0 r! t
  14. *4 v9 r0 q# r: e- E3 u, ]
  15. * This program is free software; you can redistribute it and/or
    & D: v: d( n! a8 t6 n. A4 Y# H7 V
  16. * modify it under the terms of the GNU General Public License as$ x+ ?8 N5 S) E0 g
  17. * published by the Free Software Foundation version 2.
    # h, O' `) b2 {5 u& ]
  18. *
    . H0 n$ x# M0 e# Q( |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 Q8 O# q2 h0 W
  20. * kind, whether express or implied; without even the implied warranty
    - m+ \% L! {! L" D* I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 _; X3 `' b! o, z4 z6 y8 i
  22. * GNU General Public License for more details." i6 ~6 Y/ ?$ ~( X; }
  23. */
    9 e4 O, _0 B% c" L) k

  24. 8 l. {  v* v) t' p, T6 z
  25. #include <linux/module.h>
    . y& |6 R+ ^1 c6 i
  26. #include <linux/init.h>5 `7 O1 T  P. D# v$ J7 b" j
  27. #include <linux/errno.h>
    # ~6 b1 h3 y$ S' G
  28. #include <linux/types.h>0 V* Y6 n" p4 P% K) I% C4 E
  29. #include <linux/interrupt.h>* i0 W/ Y9 E& ^1 o3 D/ v8 a: M
  30. #include <asm/io.h># O' _0 ~: g# ^# q1 j; A- l1 Y
  31. #include <linux/moduleparam.h>
      e- O0 I0 J+ U, g4 Z1 r
  32. #include <linux/sysctl.h>
    4 @" ]3 t  k; Q) |  ^4 p
  33. #include <linux/mm.h>
    3 _- `. e" [) L
  34. #include <linux/dma-mapping.h>
    . z, k+ F& O3 M' o
  35. & g) {8 N- q* ?6 x5 }  ^
  36. #include <mach/memory.h>/ v: z/ }( a  t( N4 c9 m( f# l$ U
  37. #include <mach/hardware.h>3 t9 d5 b( @& g
  38. #include <mach/irqs.h>
    ( C4 r- N9 |/ c
  39. #include <asm/hardware/edma.h>
    $ k; m& f. S& \; m. M# G+ y- i

  40. # E  u  c/ }0 }' L% Q
  41. #undef EDMA3_DEBUG
    7 b' ]( {5 y, N0 \8 {" l
  42. /*#define EDMA3_DEBUG*/9 x; H1 Y+ g5 U0 h7 B6 i& a7 \' |

  43. " L5 y$ [, M6 M$ @) `' _* w
  44. #ifdef EDMA3_DEBUG
    7 G, T8 b& N, ~0 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      k' B' U0 g1 V" t( e) I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + l( O1 r/ I. d4 U: ^6 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 d2 z$ O' z# S5 q) g% l
  48. #else
    % J0 w. Z/ a( h$ c! ]7 o) _: u+ l
  49. #define DMA_PRINTK( x... )+ }2 w* y' B! T) U$ K# K" N7 J
  50. #define DMA_FN_IN
    2 V; i0 F' ?5 x% V* }8 C* }
  51. #define DMA_FN_OUT% t+ x! }3 |% J
  52. #endif
    0 P" C$ q  y3 g
  53. 9 U: b% \' d0 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * H0 ?+ ?' R5 l% V
  55. #define STATIC_SHIFT                3
    + p% G: V3 {. L* s" M( ^
  56. #define TCINTEN_SHIFT               20
    % u1 M/ e. E8 U: t. `+ p+ l% Y
  57. #define ITCINTEN_SHIFT              21
    7 b# S- i  `, E6 R: G$ J! d0 ?
  58. #define TCCHEN_SHIFT                22* o% k# H; ]* s) i$ ]7 x
  59. #define ITCCHEN_SHIFT               23# ~8 D/ A# W  R# @
  60. ' e' G: s& m8 B8 `
  61. static volatile int irqraised1 = 0;4 Z4 |; ^  P1 l
  62. static volatile int irqraised2 = 0;5 q. Z* E1 [  c" W& J" b

  63. , w" `- {  C: N. d2 V/ v, D" R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W$ }5 S: u4 l% ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , j' L# M, P8 g& {1 A, ^9 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- R3 `/ `! Y# ?, @9 U( m' ^

  67. 7 x8 Z* N4 d% @0 E  k  x8 B
  68. dma_addr_t dmaphyssrc1 = 0;
    # _: V. U. l# k( `
  69. dma_addr_t dmaphyssrc2 = 0;  F! k9 t* W# G/ c) W
  70. dma_addr_t dmaphysdest1 = 0;
    0 d/ P5 p' _6 K- I. u( B' X5 }: d
  71. dma_addr_t dmaphysdest2 = 0;
    % b. ^3 n/ v; u6 t# c

  72. ' S. P, r/ B& L, Y$ ~! k
  73. char *dmabufsrc1 = NULL;+ b' d- v, \8 n. O; x
  74. char *dmabufsrc2 = NULL;
    / N7 }$ E  O% j/ g
  75. char *dmabufdest1 = NULL;
    . b% ~1 L4 ]! {4 n7 C
  76. char *dmabufdest2 = NULL;
    5 b' \  x7 K# j6 {
  77. % F( b# f& t& H0 {# i
  78. static int acnt = 512;) J$ m8 T" G- n4 @
  79. static int bcnt = 8;
    8 G$ k$ V, G6 X; s  b
  80. static int ccnt = 8;
    . B& p6 r5 e3 {8 t4 Q

  81. & U2 K) m* _1 f
  82. module_param(acnt, int, S_IRUGO);
    , f8 }- p0 D* r7 f9 t& P; A
  83. module_param(bcnt, int, S_IRUGO);
    " J. B: H1 a& v( U. m- F, k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 Z% `, `* `3 v! b, K0 Z6 q, {
1 @3 z8 z3 J% h$ k! w2 s( a9 e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! G) i& B  A; E$ J/ a. N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( B. V2 |. W( A' H# u7 `7 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 K5 G+ ?1 m; i; {3 E. b
& q" ?7 C5 y# U8 S
& H/ {# z) ^, J" V7 S% s" Z: v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 19:39 , Processed in 0.039129 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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