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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # Z3 T7 t4 u" ^
  1. [code]EDMA sample test application# e7 ?! H0 I+ D: w4 f: M4 u
  2. /*4 J0 s1 c5 J4 E0 D4 j( }) X& |
  3. * edma_test.c- K' _* p2 C: [7 P( H- q
  4. *
    3 H% ?+ F; {9 h& j& K' P- r& A. @" O
  5. * brief  EDMA3 Test Application" a6 B4 y2 l7 @: O( \; }- ]$ ?4 y
  6. *
    1 v0 i' O/ S& _: h
  7. *   This file contains EDMA3 Test code.
    ( \( I$ O0 B" L) i
  8. *
    ; V/ ]# k7 z2 m0 v# L, }7 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / }% X$ S  c( K. G4 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . H) s) |& o1 e2 O; ?! A. f
  11. *         TO CHANGE.8 o6 O7 i3 y+ H7 f7 Q
  12. *
    8 h$ U! l8 y( I8 K* b6 w4 k& K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' w8 y- z8 Q' a3 H6 |6 b
  14. *
    + [2 d3 ?1 G( B- s% R
  15. * This program is free software; you can redistribute it and/or
    + H& L+ b, j/ J( s5 d% s; s1 m
  16. * modify it under the terms of the GNU General Public License as7 [" m7 F! v( |
  17. * published by the Free Software Foundation version 2.
    - E. K2 X$ P0 z- @" I
  18. *& A9 k9 O' R% m5 ^2 E& a! N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' Y& F* O1 X0 g% v4 y
  20. * kind, whether express or implied; without even the implied warranty8 |7 D  o' }6 h! ?0 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 n; r5 F6 a4 Y2 w3 B
  22. * GNU General Public License for more details.
    4 w0 p& E) b; y% d4 M
  23. */0 ]  H. k! v0 S( [# w  z

  24. . Q4 U- y- t7 m( f
  25. #include <linux/module.h>" c" ~- j& `4 _; C5 a0 G
  26. #include <linux/init.h>, p* k; A( U( x" `! S2 y
  27. #include <linux/errno.h>
    $ z" f+ ?7 `3 u, |/ G4 ^, R4 X! Q4 y
  28. #include <linux/types.h>2 R- Y5 P5 D2 d( _5 g$ F  Y
  29. #include <linux/interrupt.h>
    ' I3 T9 v, F0 O9 G4 h
  30. #include <asm/io.h>3 u- f) j  Z- u, ?2 G
  31. #include <linux/moduleparam.h>
    / s: e8 z3 \$ p% I5 c1 S
  32. #include <linux/sysctl.h>
    , y7 d# n6 x% m. R( n" `) [9 e
  33. #include <linux/mm.h>
    . H% G% W& d) p& H( F
  34. #include <linux/dma-mapping.h>- c% @( V- Q5 z- z3 K

  35. 5 j1 c) i" y$ K: h- h) U9 R) @0 ~) d
  36. #include <mach/memory.h>
    1 j6 h, {- [! h! H. p+ ]
  37. #include <mach/hardware.h>
    6 @/ q/ P0 ~" c5 N+ \
  38. #include <mach/irqs.h>
    2 ^/ i/ ]' I/ d( O: _5 e4 a
  39. #include <asm/hardware/edma.h>: l8 }7 ?2 d+ r5 O! f6 g0 A
  40. # P9 b/ ?+ l- G9 J+ c  Q
  41. #undef EDMA3_DEBUG- F8 l) P& [- d5 k2 X
  42. /*#define EDMA3_DEBUG*/
    ! A* S2 O+ P0 E# p3 P; K
  43. ( R% Y, p; q" |  {5 g* W
  44. #ifdef EDMA3_DEBUG
    : {/ ?  _7 G4 z) E9 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 G- ~/ w: e  M0 }  `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n( o& H. V, m4 A/ I& m" z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 d9 k3 [, \- A+ _( U
  48. #else
    6 W/ Z0 m& k6 K; b
  49. #define DMA_PRINTK( x... )% t( @! x5 X0 u0 n
  50. #define DMA_FN_IN
    % D5 }" |4 E0 E7 |% w; P
  51. #define DMA_FN_OUT  F, Z8 D% ^% k" N
  52. #endif7 p. M- K6 T0 B$ x1 s8 A
  53. : Q# b; Z& \' }% B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 w! V4 i( F7 O! ~6 c6 I4 k  G1 \
  55. #define STATIC_SHIFT                3
    " ?; j" ]' D% e- k; N4 u
  56. #define TCINTEN_SHIFT               201 n4 Z$ l0 l9 ]  I$ o
  57. #define ITCINTEN_SHIFT              21
    5 s! `8 w! m" J4 y! O" @. A
  58. #define TCCHEN_SHIFT                22& W: d1 L: k; w7 x
  59. #define ITCCHEN_SHIFT               23
    5 C$ k4 n8 j( q8 r0 g

  60. # o$ ]4 w- d! y9 ]9 w/ f! I
  61. static volatile int irqraised1 = 0;
    : R& r# j9 B$ Y( Z7 W
  62. static volatile int irqraised2 = 0;# B* d' |8 {* T- |* ^7 G$ u

  63. : e2 ^4 _+ O$ S4 U$ e: y& M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r( \2 ~" s8 m0 B. ?! n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 p# i0 @# R$ B4 Y0 X) a; M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W+ q+ h& V! f! ]) e
  67. ' a  e6 ], E  R+ G
  68. dma_addr_t dmaphyssrc1 = 0;
    2 y% Q; s1 V* ~/ j
  69. dma_addr_t dmaphyssrc2 = 0;
    $ v( M/ X" j4 _8 i
  70. dma_addr_t dmaphysdest1 = 0;3 `5 @6 n% @7 t/ |6 B7 g5 C
  71. dma_addr_t dmaphysdest2 = 0;
    & a' ]; U2 K  w: Q
  72. 8 B; ^' {0 o; h
  73. char *dmabufsrc1 = NULL;
    ' b2 ^4 w5 p6 Z/ x+ D0 h; r# ~
  74. char *dmabufsrc2 = NULL;" j  H: ]2 W1 h' H! U
  75. char *dmabufdest1 = NULL;
    4 P0 G, ]: A( w/ A4 ]! r9 G
  76. char *dmabufdest2 = NULL;5 A% z0 q+ b7 B% b% z

  77. , t5 A" H3 G, }3 L7 V  J+ d
  78. static int acnt = 512;
    + d! y2 y2 V; c) g* j7 N* S+ I+ E
  79. static int bcnt = 8;
    5 M- W/ V+ s* r. f
  80. static int ccnt = 8;
    3 J4 f2 {. `1 H: h. J0 m' g

  81. 5 K# u0 }! q9 n4 |
  82. module_param(acnt, int, S_IRUGO);- P4 k# `8 T" [& k
  83. module_param(bcnt, int, S_IRUGO);
    + v0 t0 h8 D) }+ y8 K" z3 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 {1 f5 R+ d- c) @  ?

# P% C4 x7 [, h2 }8 W* ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# p/ W1 b% j; a$ O4 T8 [6 D8 {- M7 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ K* r9 U- u# G& m8 {+ {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) [( k3 J" u9 Q7 J# t; J- i8 W
0 c; f: H. c% H6 N! j: E1 @3 P3 f
' z& @" ]4 L+ P# s# ?1 B- j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 17:12 , Processed in 0.044964 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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