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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 O6 C4 @3 N9 s) ]3 d0 W7 _
  1. [code]EDMA sample test application: G; \8 s: t7 g: \/ A3 b% `. w8 R
  2. /*2 o8 {0 l6 u* E' U
  3. * edma_test.c
    . T. k: r2 ]# Q4 B5 S. [/ a9 _; x
  4. *
    + Q/ T/ U6 A. v
  5. * brief  EDMA3 Test Application. `- K6 H  |6 Q! O* P1 T
  6. *
    6 @! E9 Z. M% Y3 P, u( R
  7. *   This file contains EDMA3 Test code.
    4 Y" L1 S8 o9 I
  8. *
    ; j9 O  K1 ]& N% ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # Z3 k3 D0 }) ?, J* x: P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- l6 t' y, k+ F* |3 d0 ?  C. d) s* e' _
  11. *         TO CHANGE.
    # p8 _" J9 c9 \% ?  h
  12. *
    ( \4 B8 @7 L' W* T0 b' Y% V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 E2 _1 W5 R+ i# F. t; C9 M
  14. *0 B- ^: U1 b, V) s
  15. * This program is free software; you can redistribute it and/or: I5 O6 `+ R# i1 f
  16. * modify it under the terms of the GNU General Public License as
    2 x) O* Q3 z8 ^5 g
  17. * published by the Free Software Foundation version 2.
    # \4 c- h0 y6 N: Y  n
  18. *- j! f8 _- y+ L2 K( Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + z+ L  t0 l/ [
  20. * kind, whether express or implied; without even the implied warranty7 ?. Z* n8 {0 P1 H% \5 r( u" I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) y& P# C5 @( N8 P: U9 W, G* O
  22. * GNU General Public License for more details.( Q9 t9 E1 z: z: i: t) l- k! J
  23. */
    ! O1 R& C9 V8 G% Q
  24. ( K8 a8 |7 S+ V& u; l; D, \
  25. #include <linux/module.h>9 A: h- ~6 C0 n8 z$ O' e( c
  26. #include <linux/init.h>+ Z& `. d! {4 Q8 }+ k
  27. #include <linux/errno.h>
    $ k+ O# h# v6 ?6 `* b' p3 |
  28. #include <linux/types.h>  O: R* p7 p2 }. v8 X0 R0 c$ T
  29. #include <linux/interrupt.h>
    & l; k# r: R' {8 N) h
  30. #include <asm/io.h>6 O9 }6 Z$ U& G3 A2 i9 u9 W& E3 G
  31. #include <linux/moduleparam.h>
    ( w/ k0 o% [, B2 f0 s4 p8 L5 e
  32. #include <linux/sysctl.h>$ j4 k4 y' @; _. i+ J* H9 b& n* Y
  33. #include <linux/mm.h>' V+ D# [7 [3 n# O+ m4 H. e
  34. #include <linux/dma-mapping.h>
    2 v9 L7 G/ ~  L% L7 |- A
  35. 2 E* ?0 i: p  z
  36. #include <mach/memory.h>
    3 w7 z- j3 O, O/ f* H6 ?
  37. #include <mach/hardware.h>7 n& D7 w$ P1 S, Z6 O* V
  38. #include <mach/irqs.h>" y9 L% w5 H* L) a8 x! J1 f
  39. #include <asm/hardware/edma.h>6 F; M- a* {% Q$ d* C

  40. 5 c+ S' w$ {* u  b4 H
  41. #undef EDMA3_DEBUG; p) ]  M$ X" |" l& G2 I
  42. /*#define EDMA3_DEBUG*// N/ U8 W& Z& K$ |7 S! ?
  43. , {$ x& v5 p% W# U, L3 @: t  f
  44. #ifdef EDMA3_DEBUG
    ( R7 [$ e/ t1 _2 Y: c/ S% s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . U5 T( C. b& z+ O* D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / _. T0 q6 W" _9 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( o$ l1 v% m% \% X6 V' }- f. z
  48. #else% b: e9 D1 Q' P: ~! N
  49. #define DMA_PRINTK( x... )
    $ Q) M' g6 L: m
  50. #define DMA_FN_IN
    2 k7 M$ j" l4 }2 v0 c
  51. #define DMA_FN_OUT* _) p/ k$ i( J6 C
  52. #endif
    7 O0 p0 }9 T! A! R6 M
  53. 4 H* d( `( j3 ^4 G( q# Z# d" t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 L' a- v( z  @* y& p0 G
  55. #define STATIC_SHIFT                35 j; O; ^7 q# I. `$ |. n$ T
  56. #define TCINTEN_SHIFT               205 x4 z4 w" I0 L8 R" u
  57. #define ITCINTEN_SHIFT              21
    9 ?9 P0 r0 L$ C( k) }" G, h* R- {
  58. #define TCCHEN_SHIFT                22
    9 S6 j" V' ?; ?8 ?
  59. #define ITCCHEN_SHIFT               23& k  K3 P& }0 z& p6 m2 x$ Y1 o' j

  60. 8 c$ i2 G* N7 Q6 {8 Y
  61. static volatile int irqraised1 = 0;/ Z$ x0 W8 m4 c* @& V; H6 v# E3 }% f
  62. static volatile int irqraised2 = 0;
    0 ^# P/ M2 s$ g4 [4 u

  63. : Q: i: ~+ f  u* b4 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : G8 y' q- z' g7 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Z% ]* g9 @: T  {$ s) ~8 V9 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; b4 b/ [: ~' y9 _
  67. 6 f1 A- X5 ^& W; `. z8 e0 F
  68. dma_addr_t dmaphyssrc1 = 0;$ u" @+ A+ c6 d& t
  69. dma_addr_t dmaphyssrc2 = 0;8 d" [9 f9 h/ b# I
  70. dma_addr_t dmaphysdest1 = 0;- Y- v: S2 t2 |) n- T% n
  71. dma_addr_t dmaphysdest2 = 0;2 L$ ?8 R( t) c- u

  72. " ~) R% \& l* c5 W# G
  73. char *dmabufsrc1 = NULL;  w% u) `$ U0 Y7 w1 {
  74. char *dmabufsrc2 = NULL;
    $ Y, l' `" n+ d# B4 q8 t% J# ~
  75. char *dmabufdest1 = NULL;5 D' s4 R" C; \
  76. char *dmabufdest2 = NULL;
    4 G; [- y% v9 O7 @( ?

  77. 2 `6 H, Y; i/ Z' E
  78. static int acnt = 512;
    0 q" h; j+ w# k: F2 ?3 ?; B8 K1 O: G1 j
  79. static int bcnt = 8;, b) P% y7 A, d- X" F1 w
  80. static int ccnt = 8;
    * b1 S) M1 m' z2 j; U; f! D

  81. / I" C" `3 B  N9 v* [% i2 v
  82. module_param(acnt, int, S_IRUGO);; }8 Y8 W4 O2 H$ w, K1 ?; k; G
  83. module_param(bcnt, int, S_IRUGO);
    3 a$ ?' Z% j( j8 d; D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. J5 Y+ V5 s+ M+ b8 w' W
2 U+ F$ L6 h. g# k- J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 d% {1 b# d; Q* H0 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( K$ ^4 e& v% E2 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- G9 O0 r9 j: R7 S4 F6 ~/ b0 @, Z# G* t8 Y

5 p- Z% c& C) H1 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 20:33 , Processed in 0.038439 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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