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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 b& Y- K8 }' l) `, F# n
  1. [code]EDMA sample test application; s3 m1 L# ?7 F! s
  2. /*
    7 G0 k. k# `) |! k. C/ O
  3. * edma_test.c1 S& ]% @, ^7 X  z0 i9 T6 w
  4. *
    ! c$ y0 A7 `" V6 T
  5. * brief  EDMA3 Test Application9 Z& s+ o* S! f* n
  6. *9 P( Y, }. u& W% M% \$ ^
  7. *   This file contains EDMA3 Test code.! U2 l. P6 y6 i, l) \- w
  8. *
    $ _) a$ D' b1 f3 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 G5 }$ K/ k3 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % m1 v, h; n& ]" p$ W+ C' G
  11. *         TO CHANGE.1 L' H" `/ {+ t9 Z5 l! C4 N
  12. *
    4 H) ?6 H4 x# z# o0 b  ?  l" b4 P! C- X1 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , }$ l5 `% R+ s6 g. W
  14. *- `* p' s# Q, {5 `/ A* [
  15. * This program is free software; you can redistribute it and/or
    6 P" ?3 z6 Z$ M
  16. * modify it under the terms of the GNU General Public License as
    . Y" \+ }! F0 v2 k% Y
  17. * published by the Free Software Foundation version 2.1 k1 |/ }/ O' I* P1 p; d1 x
  18. *
    ) d: V. v- |, a* V7 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Z% C, n6 p+ c& ]9 H4 X
  20. * kind, whether express or implied; without even the implied warranty1 a, [( Y0 Q3 P, p: f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! C* Q7 y# E& |- c$ k( k
  22. * GNU General Public License for more details.4 W3 b$ e+ y6 n' S8 n
  23. *// \& j+ `; M* r# n2 U8 U
  24. / O$ {0 n9 }4 I9 f4 g9 c
  25. #include <linux/module.h>( V- P# F. \/ [0 {8 f8 q) y
  26. #include <linux/init.h>
    ; g& d/ a/ B2 f0 p6 K
  27. #include <linux/errno.h>
    - b, P2 [$ Z7 |$ i0 g) q
  28. #include <linux/types.h>  J! J+ [, s. K
  29. #include <linux/interrupt.h>2 z( I) l3 I- N( K* ~
  30. #include <asm/io.h>6 B  H' ^0 L7 L2 N: |
  31. #include <linux/moduleparam.h>
    ; B2 h* x; s' {. F  X" U
  32. #include <linux/sysctl.h>4 S0 M+ [( f5 K; {" r
  33. #include <linux/mm.h>4 w6 F( k/ c" k. c. q4 F
  34. #include <linux/dma-mapping.h>2 M% Z9 S* |2 X' B
  35. 4 n# @% P9 T; ]
  36. #include <mach/memory.h>+ W& ]9 ?, O& i& }! c# ]
  37. #include <mach/hardware.h>
    . s( r+ c( R. v, c6 [0 W* }
  38. #include <mach/irqs.h>
    / L1 N$ j" T6 }# w7 `  |4 {2 L5 g
  39. #include <asm/hardware/edma.h>
    - v% ?9 M* k9 v% y* G

  40.   B0 j7 u' O3 Z6 b1 H& J
  41. #undef EDMA3_DEBUG
    , {8 F& }: B7 a, H  |
  42. /*#define EDMA3_DEBUG*/
    $ L/ H2 o9 J* u" {
  43. ! A1 m, W" Z0 {; H2 h9 D0 V
  44. #ifdef EDMA3_DEBUG3 ~6 p5 Q0 N- @2 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; r: o* A0 @0 W4 c9 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 [7 k4 K! h( d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! m4 V' s3 ~0 m/ Y% O$ x+ C: x
  48. #else
    9 f4 i1 m- J1 B
  49. #define DMA_PRINTK( x... )$ Y0 Y, v' M7 t6 r% z/ r
  50. #define DMA_FN_IN
    1 C& n3 Y6 `' t
  51. #define DMA_FN_OUT( X. N$ F0 w2 @7 |9 |4 z' f
  52. #endif. r- h4 V2 L% [1 U2 T
  53. / f( H3 k2 `/ h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" w+ q7 z# t( ]1 ^
  55. #define STATIC_SHIFT                3) k5 l4 N7 z, }1 U  e4 F
  56. #define TCINTEN_SHIFT               20+ H. ]/ Q6 Y6 t1 R
  57. #define ITCINTEN_SHIFT              212 m( J7 ~( Q5 c4 F  R9 e  b
  58. #define TCCHEN_SHIFT                22( A$ K8 M5 J% i9 s, G8 ?: R
  59. #define ITCCHEN_SHIFT               23- s( }7 u1 w$ W( l/ F

  60. 1 h( g$ S) C! V
  61. static volatile int irqraised1 = 0;  q8 n5 G2 k* a/ |4 H! ^
  62. static volatile int irqraised2 = 0;
    5 X+ W1 c5 k( H& `8 ^) p/ }

  63. ! S2 a8 b# B. v( ^. [5 g' i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 m  v, g9 X3 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; `' T9 _6 Q. j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Z; Y$ \" S0 \( ?6 O; B# ?+ d
  67. # H: v. ?8 p& t% m& q
  68. dma_addr_t dmaphyssrc1 = 0;' |+ B& E: H5 f! @% g$ p
  69. dma_addr_t dmaphyssrc2 = 0;9 K9 |2 Q# V1 t6 V7 }9 \. o% E, H; L
  70. dma_addr_t dmaphysdest1 = 0;1 D4 v2 k: l/ T3 J4 _
  71. dma_addr_t dmaphysdest2 = 0;
    ; z, K' f5 A% X$ p1 z  f' I
  72. ; G9 B& ]. Y4 s/ i
  73. char *dmabufsrc1 = NULL;+ z9 ^% ~+ J& I2 L* K! K
  74. char *dmabufsrc2 = NULL;
    ; o' y4 ?9 ^0 \$ U
  75. char *dmabufdest1 = NULL;3 J) v4 }; S+ U5 x. {+ ~+ |1 `
  76. char *dmabufdest2 = NULL;, P; h# v5 y7 t; `  C
  77. : o- N/ y. B% h* J' |1 o
  78. static int acnt = 512;
    * m. u, @+ l: B% p/ j
  79. static int bcnt = 8;" B: x0 ]/ T' ^, H: l) S0 c
  80. static int ccnt = 8;
    0 t( q8 S  M7 d9 h( ]

  81.   W4 i) J' v4 T; |
  82. module_param(acnt, int, S_IRUGO);
    0 G) T6 V' ^, L: G
  83. module_param(bcnt, int, S_IRUGO);4 ~  `( I* e  i" q7 Q1 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 J% p4 a8 n7 b" }  S0 G
9 T; T$ Z" M6 w- S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 t) i1 [% b, t, R: {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) w2 g2 l- L* y/ e4 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Z2 s- s) s4 z7 n. @  Q+ \& L! H" q# O/ c3 z" @" H8 h
: U3 C/ Z9 r0 ]. R% {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 14:18 , Processed in 0.037851 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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