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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 p) n( D  m0 @/ ?9 [
  1. [code]EDMA sample test application% {9 w0 {9 C4 f9 a8 E
  2. /*. Z4 K2 o& E; X7 M; s( B/ @# P
  3. * edma_test.c) D' U( l: x2 G
  4. *
    . n; S  V1 p6 }9 F  \' [
  5. * brief  EDMA3 Test Application! ]2 a) m3 c& L
  6. *% {: h' M, J2 x5 l8 d$ A2 D
  7. *   This file contains EDMA3 Test code.
      S2 d& Y% U1 O! x& n1 E
  8. *  [' p8 J1 n! _/ t' c- F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - u2 ?- @& [) U& K2 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 W5 Z# r- _& I5 f
  11. *         TO CHANGE.
      i$ k: ]8 ^+ W% Y. A* O2 ~
  12. *# A1 H+ P. d6 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& Z8 N" @- K3 J2 u0 g& V
  14. *
    4 B7 O$ R& s$ }6 v+ p7 I; r
  15. * This program is free software; you can redistribute it and/or' n. e# R7 e+ U
  16. * modify it under the terms of the GNU General Public License as1 `6 ]5 Y- T8 G& Z
  17. * published by the Free Software Foundation version 2.
    + K, S1 N2 {- o  ^9 R
  18. *
    ( ^2 X) a( `2 g* i. }* E5 ~) M$ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, j% u5 B: p( I
  20. * kind, whether express or implied; without even the implied warranty1 a( f9 C/ s' K/ H( e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; d2 P2 B3 i/ e1 x, K. P
  22. * GNU General Public License for more details.) X1 n* _& v) O% N+ c0 `
  23. *// G+ ?  i* h& G; l9 `7 T, D
  24. 8 U: c. h/ N1 g
  25. #include <linux/module.h>1 J/ P1 f3 a* [9 C/ S( u
  26. #include <linux/init.h>+ G" p. t0 i2 H0 @9 F
  27. #include <linux/errno.h>
    3 ^1 B, {+ a8 }$ S" k* B
  28. #include <linux/types.h>
    " n* _$ `# ?# s: K7 _  d% Z
  29. #include <linux/interrupt.h>2 U0 b' M9 u, u3 t8 ^, g- f
  30. #include <asm/io.h>) V  l8 U: r; _, w  O. D* [: R. m
  31. #include <linux/moduleparam.h>
    7 F. I$ l+ U# i4 G* ?  K$ y
  32. #include <linux/sysctl.h>
    ) q0 p. U. s+ \# h! M/ }0 H# K
  33. #include <linux/mm.h>
    9 ~3 `8 R8 L* Z0 o  `
  34. #include <linux/dma-mapping.h>
    3 Z5 W& o7 S- m

  35. , o8 u- K. t4 d6 x) @, I
  36. #include <mach/memory.h>% \7 m2 }& Q" ]8 g+ n% X. I! ~
  37. #include <mach/hardware.h>
    0 D; p# l3 y; C' a  v1 s
  38. #include <mach/irqs.h>
    & x$ X1 y3 c2 q& P) n. F
  39. #include <asm/hardware/edma.h>
    : _) ]; n" |. X0 W: x

  40. 8 A3 ~% `4 \; x' J7 z9 M& Z
  41. #undef EDMA3_DEBUG" O. q+ e3 L" ]0 Z# y
  42. /*#define EDMA3_DEBUG*/% g  k+ z" v% k" ~4 d
  43. / Q5 E) Q2 [5 \/ F
  44. #ifdef EDMA3_DEBUG$ a$ J# U+ C% P: v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 o2 x; C& P: `/ A2 w4 ^( v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 k5 _1 ~# G7 A- w0 E8 O2 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - C1 R; D$ R; ^6 `3 A1 Y( \
  48. #else
    " T: `- A8 d% b' a* ?
  49. #define DMA_PRINTK( x... )
    . w. B9 O6 H! ?# A* b; _/ l+ s
  50. #define DMA_FN_IN
    9 E4 [/ B9 ]# y3 @: k
  51. #define DMA_FN_OUT
      R9 M9 w1 F; f  U2 t  G3 w4 K
  52. #endif
    0 Q4 E  q9 [- D4 V
  53. - H$ f  d* K8 t- }1 I9 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 [9 S9 E# Z% i7 h& v+ I) ?0 e9 b
  55. #define STATIC_SHIFT                32 S% \: Q' I0 K
  56. #define TCINTEN_SHIFT               20
    8 P: [" @3 F8 ?- t2 \3 p5 `7 n+ {: ^
  57. #define ITCINTEN_SHIFT              21& H3 j. d/ Y0 ~* D9 `2 l1 l; M
  58. #define TCCHEN_SHIFT                22
    ' n6 ]4 N3 W5 g5 ^9 g
  59. #define ITCCHEN_SHIFT               23
    + c9 J  q9 c8 s# m

  60. ! Z" t. V: H9 a! v3 K  k( _$ M
  61. static volatile int irqraised1 = 0;1 v' w8 M- Z  x' L
  62. static volatile int irqraised2 = 0;
    7 u$ e  S% q7 s

  63. 7 f/ M" d2 S+ }# l7 @2 T0 S! x3 t* w! J4 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & T2 W7 \9 R6 I2 ^/ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* q5 [! A" A" W! z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B# E( H! q5 X8 n% i/ _
  67. % e  B' E2 @+ {# U4 J! w* a( S- n
  68. dma_addr_t dmaphyssrc1 = 0;1 Z, e, Y' {+ X1 ~4 _5 ?
  69. dma_addr_t dmaphyssrc2 = 0;
      F: o% w6 Z. v7 s
  70. dma_addr_t dmaphysdest1 = 0;8 L3 X" S. ]6 _* G  u
  71. dma_addr_t dmaphysdest2 = 0;
    - y9 `3 d5 F2 I2 _" v
  72. # D* X! X! G$ o
  73. char *dmabufsrc1 = NULL;; w6 q( Z  P, o# x) m4 m( F' `
  74. char *dmabufsrc2 = NULL;
    + G) X1 T) k5 T* x& [9 A0 K  @7 L
  75. char *dmabufdest1 = NULL;: J; ~! E  D% G6 N9 e# K5 a8 H) V
  76. char *dmabufdest2 = NULL;
    0 X$ u* B# z2 N% U4 m, C6 N& ~7 K" `3 v9 W

  77. # T% @7 Y& }4 w* t6 B8 o
  78. static int acnt = 512;
    5 k, c7 A- d; g& D
  79. static int bcnt = 8;
    " d) l+ p0 z4 o9 x7 C1 S) g
  80. static int ccnt = 8;
    ; P! v/ Z; ?  H: u  R

  81. , u2 i: `5 E/ y7 \, F+ x
  82. module_param(acnt, int, S_IRUGO);
    , \/ C. }& x  W( Q- `. M% q' \
  83. module_param(bcnt, int, S_IRUGO);5 O# S+ C5 }1 x; o3 A  P; Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# t. i) [  Z% s6 w3 ~8 ]- n0 d% P( w7 \/ ?, P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# ^7 Y+ v4 o4 E  I+ `2 Z+ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g, G1 o: i# R% f, K3 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% ?) l4 D. o6 ]$ M8 d+ j

  j+ T8 G' m. A5 x5 e9 _$ m
9 S" o2 K: u/ q6 r2 B2 `- h  F( `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 09:46 , Processed in 0.039150 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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