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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# m# d% c. C4 I* A% r( K& ]6 T7 v0 P! R
  1. [code]EDMA sample test application
    ; n* y' z. N5 N
  2. /*
    : w/ W3 V( H( N, K5 f6 |9 u1 f. B
  3. * edma_test.c" N. r: I, e6 h6 y2 R" P9 D2 K
  4. *$ @1 G: P  U) \" v# D
  5. * brief  EDMA3 Test Application4 ]; V5 q/ N( X2 G( x
  6. *1 y& Z' x5 r$ g1 j0 A  Z$ C! a0 X
  7. *   This file contains EDMA3 Test code.
    & b) Y7 g3 M4 ^8 w1 c
  8. *
    ( k4 f/ |5 d( R8 x" s  C' g0 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : M9 [$ K1 j4 P+ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - s3 I4 _" B3 o1 S# O3 c0 d! h% I
  11. *         TO CHANGE.2 A" V( h  l% D" l
  12. *
    : q! c& |6 l0 @/ D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; ~: ^" n6 R% P
  14. *8 Z, U' f" N* l- R+ ^6 `5 z7 ^- y
  15. * This program is free software; you can redistribute it and/or2 h, L- q' G' ]5 J
  16. * modify it under the terms of the GNU General Public License as5 x0 M" T  g; K
  17. * published by the Free Software Foundation version 2.
    ' ?" {8 z& q' T! N! E5 |
  18. *0 @" Z5 Z9 Y5 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ |8 A- q& k9 V2 f( G5 |) {: D" M
  20. * kind, whether express or implied; without even the implied warranty0 a8 y8 P! K* @, X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      a3 q% i$ z" ]* ~# F
  22. * GNU General Public License for more details.# G# k8 W. F. A" e* z
  23. */; ]5 n1 E9 b  L. j3 @; p

  24. ' [' `9 Z8 {/ s1 T8 @
  25. #include <linux/module.h>
    / _3 {! k' Z3 [5 e. P) j% x) b
  26. #include <linux/init.h>) x, G6 w& J. s; w( X" d: D
  27. #include <linux/errno.h>
    4 }. r: }% J+ D/ g
  28. #include <linux/types.h>) Y- n& Z& Q9 p8 E
  29. #include <linux/interrupt.h>* p+ Y- W* o) a0 @5 l" k5 f
  30. #include <asm/io.h>  E; T6 y; \( m3 k" ^  ]
  31. #include <linux/moduleparam.h>0 F3 N$ k. {% U
  32. #include <linux/sysctl.h>. ]( G! G2 U. J5 W3 r
  33. #include <linux/mm.h>9 S$ m2 n8 m1 R/ _7 Z# c$ d
  34. #include <linux/dma-mapping.h>
    / y, @  i  F: k$ t6 N8 f

  35. 4 w9 U' C% Y* ?* q: X" w& M% R
  36. #include <mach/memory.h>
    " q- `# ]* V, q7 G! ^% n
  37. #include <mach/hardware.h>
    8 b% m% @5 x0 t
  38. #include <mach/irqs.h>5 K; W$ ?% W" u2 U0 J: P  {1 L) Y
  39. #include <asm/hardware/edma.h>
      k7 J! z! H. J4 U& P
  40. 8 n- l; x' M, ]2 B5 y5 g
  41. #undef EDMA3_DEBUG9 E1 H- U9 [% [- _' S# P
  42. /*#define EDMA3_DEBUG*/
    ( M" \% |% U- R) d. ~- |

  43. 2 c; q. b' P1 C; F1 S  R
  44. #ifdef EDMA3_DEBUG8 M/ @' q( {+ u" m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 t" h4 c# E8 E7 c5 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / n, p: p! q9 Q' O$ H" K1 R8 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Z$ w4 F- Y- j$ V# V
  48. #else3 ^" Z% D4 {2 b. F9 l  j1 I6 u
  49. #define DMA_PRINTK( x... ). M, L' G# V- ^4 G5 e4 y: r, D7 {
  50. #define DMA_FN_IN5 T) P" S0 ]4 z5 ~8 ]6 {
  51. #define DMA_FN_OUT
    9 w9 v( N: W% R' [
  52. #endif4 J. h; w) n7 I9 Q; H- ]
  53. % x9 L2 z( h% |1 r- \  x7 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 B0 t% j0 n8 M) D' }( `
  55. #define STATIC_SHIFT                3
    & b8 o, v# S3 o. k
  56. #define TCINTEN_SHIFT               20) S$ l5 G# X9 }! o  ?5 L
  57. #define ITCINTEN_SHIFT              21
    0 ]2 B* a$ {' a" ~9 c
  58. #define TCCHEN_SHIFT                22. ]2 r8 z7 j+ P
  59. #define ITCCHEN_SHIFT               237 _! H( \8 k" J6 `

  60. * @  S4 A8 s  Y$ d  \1 ?4 R
  61. static volatile int irqraised1 = 0;1 `( l* s8 U  M$ ^- H1 E
  62. static volatile int irqraised2 = 0;  P$ u2 {# \* h" \8 N/ w% f3 K* @
  63. 0 H$ B4 i  G. a. O4 k' n, ^" s( B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [4 S# t; V1 o0 d# T- l/ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! [! V8 f' h$ S2 c0 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # y8 Y- g! K2 h+ R2 [
  67.   _! r$ ?( t/ J* ?7 d* H+ z. {
  68. dma_addr_t dmaphyssrc1 = 0;$ @7 ~; F5 f; f  N/ C/ e" B: {6 }
  69. dma_addr_t dmaphyssrc2 = 0;7 ?# l$ H) w) K, o/ q/ m  h1 I* f
  70. dma_addr_t dmaphysdest1 = 0;2 c$ \. _  G: P+ R6 a
  71. dma_addr_t dmaphysdest2 = 0;
    + \4 k$ r8 X  g3 ]7 L

  72. / v  n: V: T# R: N+ l' s# i' P/ ?
  73. char *dmabufsrc1 = NULL;
    & @! Z; a/ O# A- I) ~+ n
  74. char *dmabufsrc2 = NULL;
      J( c4 N8 }7 g: ?6 ^/ V- S% y; q
  75. char *dmabufdest1 = NULL;: S5 h  P& q; y9 R/ l8 F
  76. char *dmabufdest2 = NULL;0 p2 Q2 U! @0 |4 j! I

  77. : z4 \. }4 f. v( J1 v0 S
  78. static int acnt = 512;
    ( ]5 O* u& f( N+ @) H" P' h
  79. static int bcnt = 8;) _: F/ b, J% I# ?
  80. static int ccnt = 8;# F( g& F: _0 j' _
  81. ) \5 g! G" ?& @4 L* l, P1 N
  82. module_param(acnt, int, S_IRUGO);
    + \& U% o+ w& X+ ~
  83. module_param(bcnt, int, S_IRUGO);- a3 T$ C; |3 _, s' M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; u8 R0 o* a# Y8 ?/ ]1 e: X1 K5 a

% W  c6 M2 n4 a0 B. M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ K! U1 L3 H5 R3 d% j* n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 n+ c7 X7 V# T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, \: O2 l8 y7 C- L
$ l  X3 x# _4 G! p
  K. b; ~( \! s/ {& _$ r; X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 04:53 , Processed in 0.037526 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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