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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ K; o! {- }; l1 C* d
  1. [code]EDMA sample test application
    - t  ]6 M  e. q1 t5 D7 O
  2. /*
    4 N: `3 F2 S- T$ q" j$ Q2 ?
  3. * edma_test.c/ D7 T% D0 g) g7 ~; r. C
  4. *
    ) {& d6 `* ^, N! N! r- Y
  5. * brief  EDMA3 Test Application
    # o/ y! y: y) r" f" y  t
  6. *
    7 s# y! ^' x6 H7 ^2 O7 F# j
  7. *   This file contains EDMA3 Test code.  c6 T5 }9 A- C; F4 \( m7 `) u
  8. *- M1 N" a' e! N% z8 j) T% W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, y6 u; V, M+ g) \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, |, K! K8 D9 v# B* m
  11. *         TO CHANGE.; M) J, P  d2 A
  12. *" L# s/ |$ e6 ~' V2 p0 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 C4 K  c$ v* h3 T8 M% I
  14. *
    8 ^# `7 N2 b- k! R
  15. * This program is free software; you can redistribute it and/or  U" [& k* M/ t4 [# z* m
  16. * modify it under the terms of the GNU General Public License as1 |2 ^+ `2 T( F3 b3 T+ Q8 e6 O( Q
  17. * published by the Free Software Foundation version 2.
    # |" W/ L, U: M  d' v* `
  18. *1 s- ^* _9 k5 L# H8 z' B* x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; V% c& {. E# y
  20. * kind, whether express or implied; without even the implied warranty
    4 u& h8 L1 m- [: ^1 `  [6 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: H% T& l  O( |; I0 k5 ]" F. @
  22. * GNU General Public License for more details.3 |1 R" i5 l+ P: B# ]
  23. */
    3 Q; k' S7 B& W

  24.   U: E+ b: f$ z4 m9 v/ K
  25. #include <linux/module.h>
    1 t7 }; Q" a' _, M
  26. #include <linux/init.h>
    + J5 k3 s" r* \+ \; N
  27. #include <linux/errno.h>: N! |/ ^: {6 Z
  28. #include <linux/types.h>
    . ^$ ~6 g2 E5 j$ F7 ^
  29. #include <linux/interrupt.h>
    # H9 K" C6 |- M5 v5 K
  30. #include <asm/io.h>
    8 a7 T+ q. U. A: G* {: \( R
  31. #include <linux/moduleparam.h>
    2 V) {) ~' v( a4 d  q' |4 d
  32. #include <linux/sysctl.h>
    + e3 j* q, z9 o' ^6 Y; K! r8 ^2 [
  33. #include <linux/mm.h>
    ( x) r8 t8 M" Y( `2 k* d
  34. #include <linux/dma-mapping.h>: a4 S* J/ H% O7 M3 X; x7 d
  35. 0 O( G2 z" f: ~5 }
  36. #include <mach/memory.h>- B4 G, k5 M+ Z! e: q( V; y0 ]
  37. #include <mach/hardware.h>3 j6 P/ Y/ i1 v1 ], Q
  38. #include <mach/irqs.h>
    ( l- u/ f9 \1 D4 n+ a- T3 y
  39. #include <asm/hardware/edma.h>- |* w) c+ O5 @4 T8 B
  40.   i. T! P7 _( C, d
  41. #undef EDMA3_DEBUG
    ) q8 X8 w4 _+ e, p! P  ~# ^- b2 r, g
  42. /*#define EDMA3_DEBUG*/
    4 N, s# o$ t( S/ u7 p1 H% B
  43. ) ?# x2 U: p# E
  44. #ifdef EDMA3_DEBUG
    ! B) z8 `5 m5 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! H. F6 w9 S0 s7 ^2 j# z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 J  U9 D3 T  Z4 S8 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + Y6 T5 ]4 t+ L- L% z
  48. #else
    * j+ Q. w- F0 X. `
  49. #define DMA_PRINTK( x... )
    * b* W! M4 R) z5 n) [% G2 {  J
  50. #define DMA_FN_IN) ~' c. T. i' M* `0 Z
  51. #define DMA_FN_OUT
    " V: w/ ?4 {. a( \. ~
  52. #endif% t! k; x# I2 C

  53. ( n! v" x3 M! R* H9 I( O4 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( @- }) Z3 L# m* }) a; M% _) _
  55. #define STATIC_SHIFT                3
    ' i. y% V- c! z0 F  A
  56. #define TCINTEN_SHIFT               207 j& p7 S# F1 V% A9 T
  57. #define ITCINTEN_SHIFT              21, N: b: N- b; R( S3 M/ @
  58. #define TCCHEN_SHIFT                22
    0 n9 K, q1 P0 }* t5 j! b
  59. #define ITCCHEN_SHIFT               23
    % G4 w- q, P2 J2 M' ~3 k# U/ `8 f7 N
  60. 4 ?% P1 D9 x+ \
  61. static volatile int irqraised1 = 0;
    ; J6 {' u- v: V! z$ j
  62. static volatile int irqraised2 = 0;3 K5 @  \! F  v, }
  63. : B  _- E7 ?" N- m3 f" f, A4 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; b" ~3 `; S. Q# s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" W9 u+ {* U, W  U9 l" b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 B1 t0 O" u+ L; X6 O& Y) D3 z% `

  67. 6 T. o1 g1 K$ ?
  68. dma_addr_t dmaphyssrc1 = 0;
    / h7 l& a) g7 i- \0 f) H. q3 j
  69. dma_addr_t dmaphyssrc2 = 0;) s  U- [: L: i: C  Z9 M
  70. dma_addr_t dmaphysdest1 = 0;
    " ~1 j9 f$ O1 d7 \3 ?, r1 `
  71. dma_addr_t dmaphysdest2 = 0;
    # K1 U) I$ W& y4 v) t

  72. : E2 {/ \5 [, s0 l$ Y" ^1 Q
  73. char *dmabufsrc1 = NULL;5 u- `3 n. W) T- y- b9 {/ e' q
  74. char *dmabufsrc2 = NULL;8 n( W3 A5 P+ |$ u  \
  75. char *dmabufdest1 = NULL;
    9 c, p8 c) a: y, B
  76. char *dmabufdest2 = NULL;, {4 d/ ?- G4 i6 i. `4 a

  77. * m  K9 d4 @! f! ^: r, Y. Y
  78. static int acnt = 512;
    ( m  d' Z6 j! O, d1 D  y) I
  79. static int bcnt = 8;: l/ f, J- c: O+ p& C4 o: F& o
  80. static int ccnt = 8;$ S9 S! g9 i0 B

  81. ( c% b; J5 K' @& e5 r
  82. module_param(acnt, int, S_IRUGO);$ J3 E6 E: h& ]! ]$ ]
  83. module_param(bcnt, int, S_IRUGO);" _& @* r! k' M0 H0 m7 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! ^9 g4 C. }4 s

* F  e: l8 l  P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 {- R/ I0 N; L* T1 barm-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 W8 Q  o, X) s8 b7 G! Z7 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ?, q" ^9 b' f5 Z" _8 |) Q
  v/ X+ r* Y# {. L3 A
! {2 s; o2 x9 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-7 22:10 , Processed in 0.037717 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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