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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. j8 I4 a3 e, b% }
  1. [code]EDMA sample test application
    7 R# L  B: V9 L( E$ m
  2. /*
    ( O- v  ]+ ]. @$ T0 B; D, B9 U
  3. * edma_test.c
    ( p+ L/ P7 U+ Z1 J( q5 z
  4. *) z7 O2 Q3 _0 u1 p" z+ G
  5. * brief  EDMA3 Test Application
    . D% r7 [- c% f8 J) }- E
  6. *3 Q7 o  t9 \8 F0 B$ P
  7. *   This file contains EDMA3 Test code.2 W8 H6 |! e+ B/ Q1 {) q3 w
  8. *; j( w' e; Z4 V  N. S  Y& b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 b3 @5 V- N! d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ~# v: s8 I9 i  ~1 a
  11. *         TO CHANGE.
    # y0 ?& n6 ~; T1 l/ y- u
  12. *
    ! q  p0 T; S( y$ t: s/ _1 L; \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. I* }. ]7 ~- G1 h
  14. *  z" |# V4 Q* Z6 B2 J' `
  15. * This program is free software; you can redistribute it and/or1 f' M. p  K: ~* C, l- I
  16. * modify it under the terms of the GNU General Public License as. z& F$ G( e5 K* D8 c, T6 T$ F
  17. * published by the Free Software Foundation version 2.' k; N, J( }5 w- P- n( w+ U
  18. ** _% E2 B6 s/ \2 ?; t0 s! ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ b% M* [( g6 q( T
  20. * kind, whether express or implied; without even the implied warranty
    0 [& h2 J, C5 E( \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' r; m0 A2 f0 n2 Q% C9 |
  22. * GNU General Public License for more details.
    ' i  w3 X4 H# B; E+ L
  23. */
    ) k9 n9 `, Q: d" W9 o9 K, u  I+ J

  24. 0 N4 x) ]& _0 X7 t  W
  25. #include <linux/module.h>  N" R5 h( E+ r
  26. #include <linux/init.h>6 H# d& X% ~& o( c
  27. #include <linux/errno.h>6 [! I0 t% L: a4 t  q
  28. #include <linux/types.h>0 v3 [& ~& g, }' G- x. ~8 P
  29. #include <linux/interrupt.h>
    % R9 }* I! T4 X8 @6 e( x
  30. #include <asm/io.h>
    ' S/ F9 T( x+ i9 H# |$ }8 T4 s
  31. #include <linux/moduleparam.h>7 r' N# T" _6 r0 N" W
  32. #include <linux/sysctl.h>8 ~' I( {  p- B, t
  33. #include <linux/mm.h>$ l& j5 E1 D8 _+ T- P
  34. #include <linux/dma-mapping.h>( K: k" T8 ^' e2 i: n) C
  35. # ~) n  t4 U: ^* j) s1 }# D! v1 q* }
  36. #include <mach/memory.h>: B) L$ [# q& \* `5 U
  37. #include <mach/hardware.h>' C$ }7 }$ g, v2 s8 U
  38. #include <mach/irqs.h>
    ( F* @- ]! l3 c; i" P7 J! j
  39. #include <asm/hardware/edma.h>
    4 V! d- g9 i# [, x- R5 i( S
  40. 3 P  o) g6 B; b  \9 ~, w
  41. #undef EDMA3_DEBUG
    ! |! r+ I3 D8 a  U% {
  42. /*#define EDMA3_DEBUG*/( \5 a) Y! p8 {7 S" k
  43. ( P9 K9 p, _" n
  44. #ifdef EDMA3_DEBUG
    % C  C, |$ K8 p7 k' O/ T+ c/ Z. q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) \1 _: u8 t+ T& R/ Y- k6 e" x$ M1 ^7 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~+ M1 w3 X1 ~+ E7 q1 t1 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : p! G: a- t! i* O* q: O  d
  48. #else
    - w* T# _' V7 F: s8 M% F& t  @& y
  49. #define DMA_PRINTK( x... )& S6 ]$ m$ _; `2 d2 _' a
  50. #define DMA_FN_IN
    + |8 Q$ N: F8 f& e; b/ E
  51. #define DMA_FN_OUT
    ; w& d0 L# B& F% e7 V4 y+ _: g
  52. #endif
    % G" T8 j7 l/ _% r8 [) J+ G+ \6 @8 E
  53. - K9 O1 a/ t7 m6 m9 |& Q+ s( u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - D* \0 U5 z0 K# m. ^& S' A
  55. #define STATIC_SHIFT                3- m& z% P. n/ |# N- b/ {$ C
  56. #define TCINTEN_SHIFT               201 O  L* m9 i- i1 ^' W4 Q& T
  57. #define ITCINTEN_SHIFT              21
    . W! R: B/ {4 V, S' Z/ K
  58. #define TCCHEN_SHIFT                22
    % X% C' n' P+ M8 Z; H: r4 K
  59. #define ITCCHEN_SHIFT               23
    ! k6 C6 Q6 F6 H% B6 d* X- M

  60. " [/ n" ]8 v: B( K% u* G5 C
  61. static volatile int irqraised1 = 0;# V8 U- A7 o; M" _
  62. static volatile int irqraised2 = 0;% Y0 r- i0 {2 w1 }$ m

  63. " r( `+ A! S0 N  P  |6 \& D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& N5 g! Y0 R0 ]6 i0 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ U- ~( S, F+ m& ]$ r0 ?0 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ]/ D1 Q6 z( c, q. V8 V4 R
  67. ( W6 d) P$ e' U; j# E
  68. dma_addr_t dmaphyssrc1 = 0;- j0 q6 l7 P0 O% h, Z4 O$ H. t( u- @
  69. dma_addr_t dmaphyssrc2 = 0;
    & L' w0 L. R' k% d) E. W
  70. dma_addr_t dmaphysdest1 = 0;
    7 X8 |. F- V+ E5 R/ d* E4 g! z6 x$ L
  71. dma_addr_t dmaphysdest2 = 0;3 F# n* M- a# _% f

  72. 4 w0 @/ {6 @5 m5 F4 R8 B  M0 C6 T
  73. char *dmabufsrc1 = NULL;; g2 C4 v% m- l  e
  74. char *dmabufsrc2 = NULL;
    # O+ r* f5 i, h& T& n
  75. char *dmabufdest1 = NULL;/ [9 Y) y5 Q( e) O' N
  76. char *dmabufdest2 = NULL;
    ! v# T- h0 B1 W& x* K0 U

  77. % m% I: r* |$ c, ], f8 t
  78. static int acnt = 512;3 E9 z5 H/ b/ k4 r: H
  79. static int bcnt = 8;
    ( C- K* `  M7 G2 T
  80. static int ccnt = 8;9 F$ ?6 B9 X! y& g' A/ Y5 D
  81. 2 @2 A# A& F+ R; S- I2 {  K& _4 w! e
  82. module_param(acnt, int, S_IRUGO);! n! N8 p& X- N3 r  `5 G
  83. module_param(bcnt, int, S_IRUGO);
    5 J* k9 q" o9 o' [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) `2 K- S' m; T! l

( C' e' F& z9 m! ^9 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- E( d% W; o! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 i& g0 t6 [2 Q7 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" L4 t% c  J5 W  y9 t. Q7 s9 k: x
/ W1 d. q& p" a9 v
9 R4 k1 |+ @. ^$ I) X# B/ m* T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 12:57 , Processed in 0.039601 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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