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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ]) v/ r, f$ w' c$ ?
  1. [code]EDMA sample test application
    0 h; x. X8 A  _. X) n8 {: n
  2. /*6 b! i' k0 s3 o5 r6 r
  3. * edma_test.c
    5 _# f8 n* F& @6 I7 E' ^3 h
  4. *1 @+ d+ G: [7 j" E6 N7 q) }, u
  5. * brief  EDMA3 Test Application
    3 f5 `4 ?- q8 Y6 h
  6. *
    , C: @8 ^: L( x: N$ V- o+ P
  7. *   This file contains EDMA3 Test code.) @: u; T  V5 u2 y; v/ E" q% H" L$ h/ Z
  8. *( k! a/ y: a9 N. T" \0 b, }4 f" Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 g2 ^: `  R; x* a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % d0 X7 D; }" \, C; x3 ?, h
  11. *         TO CHANGE.
    4 t6 F7 e: I- G+ E1 `
  12. *
    6 P+ ]) z" C+ C* r1 G8 H; b! r5 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" @' `+ H" x& g( [9 R+ q7 Q
  14. *
    & O2 k0 t4 {) i6 c9 z& @' Q7 y9 V
  15. * This program is free software; you can redistribute it and/or/ M# e' G; p5 L( P9 I! g: C
  16. * modify it under the terms of the GNU General Public License as
    " F9 a" H+ x$ ~  c; j
  17. * published by the Free Software Foundation version 2.
    ) I, g4 s9 W8 D% M
  18. *2 O2 A) U" p, I& ]& t. f' s, o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 f2 i4 A9 T, `6 {1 `9 r
  20. * kind, whether express or implied; without even the implied warranty; s0 j/ B# a9 q1 a0 k- E; e) @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ G! @, J, D5 n" ]
  22. * GNU General Public License for more details.  d* b$ W9 y& _$ w9 B1 q% W
  23. */
    % x0 v* e% Y3 @' r3 g
  24. ; Y3 e' L2 w9 S9 P) y6 {
  25. #include <linux/module.h>
    3 `8 g# V: t- K! z( F
  26. #include <linux/init.h>
    ; @' K1 E' `0 O7 G
  27. #include <linux/errno.h>0 X; n4 ]/ L) ?2 L* r4 ~
  28. #include <linux/types.h>
    & r/ p* V6 }' l' Q5 D* f6 ]
  29. #include <linux/interrupt.h>3 [- P& g$ A+ W
  30. #include <asm/io.h># H) ^& E8 }0 @) Q$ u6 n4 A
  31. #include <linux/moduleparam.h>
    9 B2 O2 P- S5 {$ r' ]
  32. #include <linux/sysctl.h>
    " {  p7 ?0 Z- T2 h" n( H
  33. #include <linux/mm.h>
    7 I; U5 g3 n* w, x2 F* i
  34. #include <linux/dma-mapping.h>
    ' @8 {( V/ b% Z, B$ B

  35. * n5 ~8 }$ e3 f# ~5 g* S& b
  36. #include <mach/memory.h>
    8 E8 T  _0 L2 n. m! u& J$ i
  37. #include <mach/hardware.h>
    ( F9 R% u) C0 M7 E0 q$ ^) K2 R& D
  38. #include <mach/irqs.h>
    1 v+ g$ c" J% [6 e% e
  39. #include <asm/hardware/edma.h>
    6 T1 t* L/ m$ @0 W" N" j
  40. " L; O$ X1 ~5 K, R* c
  41. #undef EDMA3_DEBUG+ n/ b" C5 d% p' c
  42. /*#define EDMA3_DEBUG*/
    ; h# @! ?: F1 p8 k) n
  43. , x+ A$ c% ?1 m- O
  44. #ifdef EDMA3_DEBUG- I3 |0 F7 O0 b% L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 }4 B( J8 h. Y7 `1 b- d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : x7 C; ^( q, ]* W2 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). Q4 }1 r$ a+ y. G! r
  48. #else7 @0 c. D! S$ o" ^& S1 t# k
  49. #define DMA_PRINTK( x... )* }$ l5 r$ v3 }- ]3 D4 f
  50. #define DMA_FN_IN
    , j  J  q( C* E4 A# |; F
  51. #define DMA_FN_OUT7 P8 N1 t8 `7 Q
  52. #endif( ], b) [7 o, m: _# X, Z2 Z; Q6 K* e
  53. * K) k! [) l2 t2 b9 ]; e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " w1 x+ j% {. j$ l7 j8 W  m
  55. #define STATIC_SHIFT                3
    ! h6 U! M' e8 v# o6 z0 u" Z
  56. #define TCINTEN_SHIFT               20- g1 K$ D# L5 ^4 q; k! ?, H" {
  57. #define ITCINTEN_SHIFT              21
    ' }/ b' t6 H& H! Y; o% Q
  58. #define TCCHEN_SHIFT                22# ~$ Y: e4 \8 ~' f2 c# s4 U
  59. #define ITCCHEN_SHIFT               23# Y) @5 d2 h! V1 T' N
  60. 3 e0 ^- f% N  g
  61. static volatile int irqraised1 = 0;" x( }% i. Z! \* F. \4 Y$ y! w6 x' H
  62. static volatile int irqraised2 = 0;. K# K/ c& m$ x: m8 j7 q

  63. ( p+ I; v% Z7 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  K0 O' R# L! o" W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ?) {+ L, `1 ?4 Q+ `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 S, e4 O# n1 b, x$ V8 f) q

  67. * S0 Z( P% v/ a8 A& c( S
  68. dma_addr_t dmaphyssrc1 = 0;. F4 P1 W) S3 }$ d7 Z
  69. dma_addr_t dmaphyssrc2 = 0;0 I; M5 j4 M& k/ F. [( d
  70. dma_addr_t dmaphysdest1 = 0;
    5 C$ E1 j' q, @- R9 F# D  g
  71. dma_addr_t dmaphysdest2 = 0;# p5 ^& i! h+ `2 R) F; K

  72. : v/ X, ~  Z, m) L
  73. char *dmabufsrc1 = NULL;- ~7 I' }9 x; j. a3 j
  74. char *dmabufsrc2 = NULL;% e) J  ~( g% \( r5 t; S6 [5 x
  75. char *dmabufdest1 = NULL;
    % h  q. F# l% j, E' \# V, Y4 O, |
  76. char *dmabufdest2 = NULL;. a  }$ e2 p9 b
  77. 6 c% @6 x  [+ N( D5 A
  78. static int acnt = 512;5 w& s- g/ E% Z" l
  79. static int bcnt = 8;* l( B( r: u9 m- m- S
  80. static int ccnt = 8;! b5 l9 M# ^1 R9 t" Y

  81. - [% r/ }+ B! E! m' `4 m% X: _$ m
  82. module_param(acnt, int, S_IRUGO);
    3 m% N0 e, W+ |+ c( A% w7 S* _
  83. module_param(bcnt, int, S_IRUGO);1 ^  k- ^" B% h5 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  O9 O% y. J. m
, V4 |' M8 l0 Y6 P- c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- b, P' e: h5 g) n$ F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 h! \7 P! j  k; ~, i  {* i6 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 G) o& G: q8 C1 j  p! J2 z  r2 [

/ o  `/ ^5 R6 P
! d& ]6 A$ U* f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 11:35 , Processed in 0.050953 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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