OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 T) Y4 @6 O2 r
  1. [code]EDMA sample test application
    " m' k' ^. C+ ?7 y  A% o
  2. /*
    + @, Z! N2 h( I: V9 L5 q5 Z5 I
  3. * edma_test.c& f5 t! R% Q. X2 g4 H% K" v6 ^
  4. *
    4 e5 d* F1 r; @
  5. * brief  EDMA3 Test Application
    - n7 H! V; a/ j: `9 w) [
  6. *8 `& a: Q$ I6 a. ~% d
  7. *   This file contains EDMA3 Test code.: L9 d* n3 G) ^1 O1 R; J
  8. *
    , h: U! G) W4 w$ j5 B* n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - a; `# r5 b( v3 |* e: N% V6 R+ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , h7 ~0 A! X* O" y8 Z. ~
  11. *         TO CHANGE.
    ' {4 p9 o0 C3 c( N
  12. *6 Q" W0 W+ B* m8 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 w5 o) j# T( h8 J
  14. *& ?* L- X/ }7 C5 m  b4 m4 S& F1 `
  15. * This program is free software; you can redistribute it and/or# d3 ~7 J; w8 X! o. l7 J
  16. * modify it under the terms of the GNU General Public License as
    7 M0 ]& z. N" x& H9 g7 }' O6 ^
  17. * published by the Free Software Foundation version 2.# ^( e( }- t# M# E- w& E
  18. *
    : L' T! h. i: Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 x- G. D! ~) U. A, h
  20. * kind, whether express or implied; without even the implied warranty
    ; S: e. @+ L& p9 Z* g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 _, P1 z: \  Z# c9 |# P7 w& d) k$ ^
  22. * GNU General Public License for more details.! q- n) j/ i8 T5 o
  23. */, ~% Y* R$ o/ L1 O' _: ~$ r

  24. ( r/ c6 T  q9 g8 c
  25. #include <linux/module.h>
    $ J% B! E9 `7 V. j) b- o
  26. #include <linux/init.h>
    , ^6 W; k0 m9 o% Y4 E% \
  27. #include <linux/errno.h>- e' {% O0 m' d3 y1 Z5 d. M
  28. #include <linux/types.h>6 x6 e  U- Y: E& w2 o) u. @; `
  29. #include <linux/interrupt.h>" {" J; B; _9 \+ z0 V8 d
  30. #include <asm/io.h>
    8 h. P3 P- d8 a3 i2 S1 n
  31. #include <linux/moduleparam.h>
    3 _6 c* [- u$ M1 n
  32. #include <linux/sysctl.h>
    * r% E5 [8 t/ L) E% ^9 e
  33. #include <linux/mm.h>
    4 Y) v/ C* y* _: y! Y
  34. #include <linux/dma-mapping.h>
    1 [# E( W6 Z9 {: e  i4 B5 x
  35. ) I$ T! _2 H1 t# q$ r$ W9 y+ _
  36. #include <mach/memory.h>0 _& B' k( i. Y5 h
  37. #include <mach/hardware.h>1 P9 N. {' n  N
  38. #include <mach/irqs.h>4 f4 o8 l2 f1 r7 V  I! D5 `5 o# Q
  39. #include <asm/hardware/edma.h>$ O3 m) Y8 u: a2 L) c4 G& ^7 G+ `
  40. * C3 s* U2 j0 {2 K5 v
  41. #undef EDMA3_DEBUG4 ]8 k6 d/ r- }# }+ x9 R
  42. /*#define EDMA3_DEBUG*/+ O' l5 Y- b! ^+ q7 [7 `  C( ?

  43. 5 {2 q+ t9 [+ Z6 N) a9 I
  44. #ifdef EDMA3_DEBUG* n# O9 O5 d: m, g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 ?( M& J* x9 I7 {6 }  B# A0 W& B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): b, E/ f* f$ f' U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 p& G7 q# \7 b; [6 N, T
  48. #else
    ! d/ \$ X( t2 m+ }( b
  49. #define DMA_PRINTK( x... )
    1 I7 Q1 w7 L  z
  50. #define DMA_FN_IN! L, ]* e- q  B  }* o; @
  51. #define DMA_FN_OUT
    ! a  t$ Q: j5 `7 t4 l' J( B
  52. #endif: h+ D9 p. D" N+ {& f, r$ r8 D

  53. & U! U2 q. [! z( ^  F, z5 Q$ E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; ?" e/ q9 C% E' A. y
  55. #define STATIC_SHIFT                3: O8 _( N; V( c) @; B
  56. #define TCINTEN_SHIFT               202 _9 X/ a& ~) d9 v
  57. #define ITCINTEN_SHIFT              21
    ; l0 Y* c  N' Z0 Q8 I
  58. #define TCCHEN_SHIFT                22
      A0 g$ Y$ s; m- |5 G& E
  59. #define ITCCHEN_SHIFT               23
    3 D- B  S; ]+ b+ O0 O# X# Q8 U
  60. 9 J2 m) k2 x* K7 m/ S* c$ e
  61. static volatile int irqraised1 = 0;
    4 n* C' n" l3 b9 c' e# i- ]1 Z
  62. static volatile int irqraised2 = 0;4 h: D- K# K4 L+ l1 @4 M) _7 n( G
  63. / l' {  E7 k# q8 f, H( W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 w" j7 C8 |) H7 g# N1 T( P( C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a( {, M9 T2 e; A& f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; m! s$ a' S- ?7 o

  67. , G" N" s) r7 Q+ |. E, v* I8 M. B" I
  68. dma_addr_t dmaphyssrc1 = 0;4 t" ?* `! z$ r' q* W+ `6 ^3 d2 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    5 V: D6 e, R( a' w- u; ]4 h, p
  70. dma_addr_t dmaphysdest1 = 0;/ x1 {+ F: y: j
  71. dma_addr_t dmaphysdest2 = 0;
    / E3 G) d+ j* D4 h$ c( P) K
  72. " N( `3 P, e0 j+ V+ w0 D) ^
  73. char *dmabufsrc1 = NULL;
    + T7 i& _8 d# K2 W
  74. char *dmabufsrc2 = NULL;
    5 f0 o: P! I* L1 I& N& j+ Y
  75. char *dmabufdest1 = NULL;
    : p8 I2 M# a+ n2 `
  76. char *dmabufdest2 = NULL;+ |+ X3 l2 k% d; N/ u/ g
  77. / e3 W7 E. ~% z3 d; A
  78. static int acnt = 512;& d: D* D0 @( }$ I7 w' E
  79. static int bcnt = 8;
    * |! C& u' }. `% D9 S  k
  80. static int ccnt = 8;& v" w$ b) h6 G1 G  ^& ]8 W' X5 F

  81. 5 z+ e, {; C8 l8 k
  82. module_param(acnt, int, S_IRUGO);3 a4 F1 i# C+ j5 t: Q$ m" e
  83. module_param(bcnt, int, S_IRUGO);. A7 l5 {/ X1 z4 A, P( ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ V1 O/ g6 q) C  w' b& K# g
4 h" F5 g4 K4 [) j) y' Y9 b5 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ^0 F; T6 b! N) x+ k4 g8 T, s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]4 `0 h& ~5 T& K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ D$ K# V0 l& q
/ ]. d. T8 [! s1 o( I& j, w
2 R& u0 Y& Q" v# @% \, Y2 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 13:24 , Processed in 0.038368 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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