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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 t3 A/ u6 t3 |; t
  1. [code]EDMA sample test application+ h' H! m" P+ {, a5 v' e
  2. /*: R- ^- h$ m" v. z2 T. a
  3. * edma_test.c
    ' I. N  P! Q* a
  4. *
    9 F# K5 \) _1 V. s5 V
  5. * brief  EDMA3 Test Application+ d$ o8 N) f9 m
  6. *
    7 p( E) e1 Q5 K9 E# J. @4 {7 @
  7. *   This file contains EDMA3 Test code.1 |: i! }' Y, z
  8. ** p' o+ h- M  x+ M$ {, D! v+ V4 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 z  O9 ?$ z& g9 \3 I. f5 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      Z# s! k: r+ ~' ?6 Y- {
  11. *         TO CHANGE.% K( C" d% ?. q# b4 @; ^- g2 E5 v
  12. *# A( [/ z% P/ x6 }- O+ X0 {* Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- s# K3 W2 y7 ]) U
  14. *  Y* K9 {% @& ]( F  U
  15. * This program is free software; you can redistribute it and/or
    0 y/ A8 ~# O+ c. b( [/ N! x: A
  16. * modify it under the terms of the GNU General Public License as
    / I! \7 X( b% v2 m# W. U' X
  17. * published by the Free Software Foundation version 2.
    3 R$ J% e- v& [5 R- f
  18. *- T+ R6 Z& n+ @+ _2 p! H4 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # L* C2 A3 V9 ]& ^
  20. * kind, whether express or implied; without even the implied warranty* F0 Q7 E' I$ j8 t5 J6 l0 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : P) Z3 U) j: T' f$ o) J( A
  22. * GNU General Public License for more details.
    5 p2 L. v0 U3 f# H4 F
  23. */
    ; T+ r/ L% b0 z0 F1 y
  24. 0 `6 H; Y$ q$ M4 ^* `  U" _* y
  25. #include <linux/module.h>
    ) A5 [+ M# }0 u( l& z, H" o  F
  26. #include <linux/init.h>
    ( }0 `6 g/ M# y: l' j
  27. #include <linux/errno.h>+ ]/ w5 r  W' n: [/ [
  28. #include <linux/types.h>3 I: Z- X9 }3 z9 G# J& u
  29. #include <linux/interrupt.h>- I. `, r% N' K
  30. #include <asm/io.h>
    " v# B1 Z6 }' M0 r8 f8 i
  31. #include <linux/moduleparam.h>
    6 j! p7 F0 V; X, S
  32. #include <linux/sysctl.h>' l, X$ N# h- a( S  L% }; W
  33. #include <linux/mm.h>8 {+ Q% f1 a/ R% [- N: b
  34. #include <linux/dma-mapping.h>- V8 o, ~  ^( n

  35. ; Q4 R4 V$ h! E( E, \/ {
  36. #include <mach/memory.h>
    ( G$ b6 d" @# s' I3 \  V4 \
  37. #include <mach/hardware.h>2 y& c5 {5 T" q( G8 N
  38. #include <mach/irqs.h>( D: `5 b- U6 l+ @. z8 v
  39. #include <asm/hardware/edma.h>: V/ B$ X/ f6 v% l1 H) k( j
  40. . T5 S& `+ A; O3 `+ \+ Y
  41. #undef EDMA3_DEBUG
    ; J! g3 K" `1 A. r
  42. /*#define EDMA3_DEBUG*/
    " C  A8 }: |6 Z
  43. $ e4 `  ~: [% I6 v2 }$ v) X% v
  44. #ifdef EDMA3_DEBUG
    , C, {. L" i* S/ {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 M$ ?- g! g) i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' ]) \0 r; e' {/ g: `. M+ v' s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - @4 t& V/ B. {& X
  48. #else
    0 z7 c0 \* ~2 ]& v' W1 t# J
  49. #define DMA_PRINTK( x... )0 K& Z9 `5 m9 W! i; X* c
  50. #define DMA_FN_IN7 C/ H3 v8 a6 j  j9 P9 o' Y
  51. #define DMA_FN_OUT$ ~8 u1 [. K/ [% v3 K
  52. #endif
    ' c; p. V, E6 Z$ e
  53. : q0 Z4 E& b- z& X6 U- A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 j3 S: e4 r+ K$ j( U
  55. #define STATIC_SHIFT                3) P5 B5 ~- l6 X' j: B$ R# p
  56. #define TCINTEN_SHIFT               208 m: L2 A% U/ t+ h5 v" s
  57. #define ITCINTEN_SHIFT              21. @3 U: [8 f9 }* \  d
  58. #define TCCHEN_SHIFT                22
    8 v/ l% M) r0 N2 l2 G( K" P/ A! Z: t
  59. #define ITCCHEN_SHIFT               23* j; K3 q6 B- Z- g
  60. ! `: U+ l! A  x, w4 U: ?
  61. static volatile int irqraised1 = 0;5 c( L9 h: ~! Q1 b0 o5 }3 T0 m
  62. static volatile int irqraised2 = 0;
      w9 \9 k4 C# E
  63. - Z5 P) p: E7 ^; ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / A) t( w# H+ M, ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D; P. M% I+ N% p5 {9 e2 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; r: T' B5 Z! g/ k7 B( b5 K
  67. ' z% z/ A! }: k) X; [% M3 X  Z2 S
  68. dma_addr_t dmaphyssrc1 = 0;
    6 Q" I+ R3 D! N
  69. dma_addr_t dmaphyssrc2 = 0;
    4 {; X/ d4 X& e0 g
  70. dma_addr_t dmaphysdest1 = 0;
    8 R' C9 F4 e# \- w
  71. dma_addr_t dmaphysdest2 = 0;
    4 c! |- g; W2 j  m/ F2 s1 M; |
  72. 7 @. R0 l0 h' }5 ?, G
  73. char *dmabufsrc1 = NULL;
    6 G! H$ s' r* n; d6 N" d
  74. char *dmabufsrc2 = NULL;* F/ Q% O* d* V1 x# X& j8 [
  75. char *dmabufdest1 = NULL;
    / p) ^9 R* z+ ~% K
  76. char *dmabufdest2 = NULL;
    . o, N+ Q6 P+ a) B
  77.   C7 P) j+ B" P! U, z
  78. static int acnt = 512;
    * W$ k" G  S3 h7 z" k5 w% @
  79. static int bcnt = 8;
    1 R0 T! O. F+ g
  80. static int ccnt = 8;
    ! M( u1 M( |! ]
  81. ! L& c8 I; |! |+ U  A( F
  82. module_param(acnt, int, S_IRUGO);
    3 P: R9 w, _* j% H( T
  83. module_param(bcnt, int, S_IRUGO);
    : J4 j- [$ n" Y% u3 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 C2 n2 b3 X: G& ?

4 f' x: R5 D  p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ E7 }3 M6 z* g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# p& k$ n4 S4 C5 ~, ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Q7 @4 A& Q  M6 D& _% _
6 I; M5 B3 N8 K
/ r' e1 b* e: n! k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 14:54 , Processed in 0.038995 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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