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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ P1 v8 }( U  g0 n: T
  1. [code]EDMA sample test application
    . a8 ^% a. ^! e* L7 F- A' E
  2. /*; g/ @7 Z! ?! t6 y
  3. * edma_test.c
    * u; U3 y. A3 ~' S
  4. *2 N8 m. X" n- A3 D# f% a- f% D
  5. * brief  EDMA3 Test Application3 i1 ^* g0 v8 x0 x2 F
  6. *! e& a+ a4 `1 ]/ \: e6 v3 @1 ~
  7. *   This file contains EDMA3 Test code.% \* U' G! I% Z) d; r8 }! o
  8. *' s# S5 ]4 |" G- U- n% M) g7 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 A& N, W: R4 B7 X9 w% d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 p$ {0 J: N5 [. M& a
  11. *         TO CHANGE.1 m) P0 X& `- c" r
  12. *
    8 O# y5 `$ |! ~# I3 i& p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 e. A( u9 w" I8 W! p9 C2 \% Z
  14. *
    + t& L9 x2 {" G6 y) R8 Q# u
  15. * This program is free software; you can redistribute it and/or
    , M2 V3 O* v+ ^2 l# T
  16. * modify it under the terms of the GNU General Public License as
    8 w: p7 d# D4 R
  17. * published by the Free Software Foundation version 2./ l+ s4 e: X7 ~3 i. o1 d+ `4 y
  18. *
    " _( `4 C( J4 m$ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& X2 K6 y2 l  ?7 G3 T# I
  20. * kind, whether express or implied; without even the implied warranty
    % n  L: P2 u0 g; G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # a! `- T1 U$ _7 \5 ~7 k
  22. * GNU General Public License for more details.$ F" T; ?* M$ p3 t4 ]3 u0 _, R
  23. */9 I" \& V5 n6 ]

  24. 4 _* Q* Y" V- m3 K3 x" d# z
  25. #include <linux/module.h>: L4 n  s9 H' c- s# Z
  26. #include <linux/init.h>
    # d$ C' @( \$ h7 v
  27. #include <linux/errno.h>. \2 t4 ^( `% F0 X" j9 r* j/ e
  28. #include <linux/types.h>
    0 i# t- ^. V0 q
  29. #include <linux/interrupt.h>
    / k4 f& ^  U5 g( Z( G1 B
  30. #include <asm/io.h>8 u: [7 b1 u: M- ^9 B
  31. #include <linux/moduleparam.h>
    ! B# Y/ Y$ w8 M% ]: o, b
  32. #include <linux/sysctl.h>5 d7 C* h- z% S, Y# S
  33. #include <linux/mm.h>
    1 p5 D! i; \8 Q) H
  34. #include <linux/dma-mapping.h>
    ( X& D3 z& r; @4 [; o, O
  35. 2 X+ O1 y( b* Q, ]; J2 ]
  36. #include <mach/memory.h>
    ) Q: t8 s) o( _
  37. #include <mach/hardware.h>
    4 S$ C9 N# ]; @9 ^
  38. #include <mach/irqs.h>, a$ [  k; r+ i! G5 R0 [0 x5 r
  39. #include <asm/hardware/edma.h>' m: m$ b' F' c2 \: I& P' [
  40. 8 f" S, D6 _0 q
  41. #undef EDMA3_DEBUG& B% N3 |! L% a3 |
  42. /*#define EDMA3_DEBUG*/
    ' B4 n9 D' P0 K# i' A
  43. # k( z% h& p' v
  44. #ifdef EDMA3_DEBUG% H8 A2 b6 b% p4 Q5 e& O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' @9 R7 j! ^6 U* [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 c& L2 v4 z( N& L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ z% d* y4 @3 t/ ]4 S7 J; [
  48. #else
    2 i" T2 A* P, t
  49. #define DMA_PRINTK( x... )4 j  t) X0 M5 r+ g4 z, a$ @
  50. #define DMA_FN_IN
    3 S7 F4 w" w+ F# M- \) H
  51. #define DMA_FN_OUT
    % s% J0 A6 R7 f
  52. #endif
    % B$ q  s- o9 f, q4 g( f8 [

  53. , W* f! e5 s) v8 G) V6 a5 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); p- ]# P+ N' \8 M6 Y- C
  55. #define STATIC_SHIFT                3
    " J1 ~, o" G0 `9 E
  56. #define TCINTEN_SHIFT               209 h6 [! @2 q" i& a4 N
  57. #define ITCINTEN_SHIFT              21
    . `" N" W" D0 z* o
  58. #define TCCHEN_SHIFT                22
    0 F- Z5 E4 A; S! x: f- I, d5 {
  59. #define ITCCHEN_SHIFT               23. U' H+ C6 l, W0 m0 [! H% d5 F' u

  60. 7 z6 O( Z9 z$ a3 @4 `
  61. static volatile int irqraised1 = 0;
    , L; c. F/ x1 m5 l4 C
  62. static volatile int irqraised2 = 0;/ J+ R4 k' ]1 s+ C0 o7 m, |
  63. " {! c; u0 _& [" B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 y" {8 a$ W% r# n) C" M7 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 [# X8 A- o: c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 X6 x4 G* n: e/ Z. x
  67. 7 |# ?9 Q7 ]* `0 L; i2 P' i0 B
  68. dma_addr_t dmaphyssrc1 = 0;- i! W+ B& g9 y0 M' f6 p% A# I
  69. dma_addr_t dmaphyssrc2 = 0;2 p9 U4 i$ o6 N& x& P: @5 T4 {; I
  70. dma_addr_t dmaphysdest1 = 0;+ O& \+ j* _6 s4 S1 g
  71. dma_addr_t dmaphysdest2 = 0;6 c: E. Z- V1 R6 \2 O

  72. ; }2 B6 N' q9 F9 B$ c  ]8 V5 @  ^
  73. char *dmabufsrc1 = NULL;& |; m1 h$ W  N8 g
  74. char *dmabufsrc2 = NULL;
    2 b8 Z% j7 x3 D% q% E0 X' C) V
  75. char *dmabufdest1 = NULL;6 Z6 U6 G  Y  t$ H
  76. char *dmabufdest2 = NULL;0 p/ M0 x4 {. C
  77. ) q3 @, M8 {& d% q+ k5 k
  78. static int acnt = 512;5 E/ T* M* L6 c7 J3 R7 F" D
  79. static int bcnt = 8;. ]( W- S9 O8 U, i$ w' f  g
  80. static int ccnt = 8;' e8 ]+ s  N: Q: Z! Q3 @

  81. . x* _! k- H& E; ]9 X
  82. module_param(acnt, int, S_IRUGO);
    . s" M5 S8 x6 M! l# r" v
  83. module_param(bcnt, int, S_IRUGO);
    ) y4 F" |8 i: }( J7 t, Y$ E8 S# S# }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 U6 t- k. B7 l; d

# [4 J) y7 h+ |9 e* P4 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 N2 y2 a# b) P! D! carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ _/ f0 x6 j) Q) h/ I# I6 g8 J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# U2 i, t" `0 G7 g; k
" V- _2 t% n1 t( P- C& y7 R. T
! ?; E# t, }4 I9 R8 B  W" Q- e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 12:40 , Processed in 0.039374 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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