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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 G5 x! j$ ?3 A2 q3 T4 ^9 ~
  1. [code]EDMA sample test application0 z; F" Y' o# M
  2. /*
    $ X' J0 v  t/ H' I/ K8 k/ V+ D
  3. * edma_test.c
    ' q8 T4 A. X0 k
  4. *
    ' y+ l- P. V+ f
  5. * brief  EDMA3 Test Application
    / b4 F1 V2 w% q3 A3 ?! |0 a. E
  6. *
    1 j" [( M+ u7 [/ f* m
  7. *   This file contains EDMA3 Test code.7 l8 y1 \& b$ m
  8. */ o' d; B- ]" F+ b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + z4 U; D6 p) d# Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! G* Y0 m2 r! O  w* ], ]8 J- j
  11. *         TO CHANGE.
    3 d, H" {) \+ g5 C. h9 D
  12. *# @5 h) ~1 a$ b* B# E! A# u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * U0 l6 l8 ~. x8 b. I! D
  14. *( W; n6 ~7 N" P' P; T5 w( a9 @
  15. * This program is free software; you can redistribute it and/or
    5 d7 s( x( x) v- F2 p, `6 W
  16. * modify it under the terms of the GNU General Public License as: i1 w0 e0 Q7 [
  17. * published by the Free Software Foundation version 2.7 M1 O! w7 N% F3 @
  18. *: g7 p: }" h  ^3 W; C( y2 q6 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 y8 O$ l/ N  s, q& ]
  20. * kind, whether express or implied; without even the implied warranty
    3 B6 B" e, S2 U" p$ N7 N" Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % O) w6 S2 O, C6 F. i- l: B, n# @
  22. * GNU General Public License for more details., x+ n6 M* V, y, T2 K
  23. */, ^: n( P1 o9 [+ c! u5 H7 `& ^

  24. : K% i" j% i, z3 ?0 @6 }& o
  25. #include <linux/module.h>  ?( E) [+ J" U9 e
  26. #include <linux/init.h>
    / ?" W( F; k1 O
  27. #include <linux/errno.h>0 P) m' L! T3 @+ y
  28. #include <linux/types.h>/ k+ f6 K( _7 B5 f0 J1 q
  29. #include <linux/interrupt.h>4 F. v7 t' v7 L
  30. #include <asm/io.h>- l8 g6 g1 |; `
  31. #include <linux/moduleparam.h>
    & ?3 u% c# C8 x4 j+ v8 f" P
  32. #include <linux/sysctl.h>
    " S0 z, N9 K) _- F; R5 @
  33. #include <linux/mm.h>
    1 `) E; j! t7 K! @& i- y2 q
  34. #include <linux/dma-mapping.h>* I7 |7 G/ i/ P2 j! Y
  35. . V8 S: O+ h) Z. Z0 w
  36. #include <mach/memory.h>, H/ J. m* O9 d
  37. #include <mach/hardware.h># |) Z+ m& B, ?( r2 D9 o9 {
  38. #include <mach/irqs.h>) p  W9 Z2 U- @) t3 L" c9 a
  39. #include <asm/hardware/edma.h>
    ) X; w; Y0 R  o, ?

  40. 9 d7 {: F5 z5 R
  41. #undef EDMA3_DEBUG
    ( q7 I* [9 Q5 _
  42. /*#define EDMA3_DEBUG*/# ?: V' ^! z( J2 N1 Q( |
  43. + ^! L# [, y6 K" w) i2 x+ [5 Q
  44. #ifdef EDMA3_DEBUG
    , Y3 u! ]- o6 H/ k0 ^6 G: H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 F- i$ L+ G" L: }) ^  `% T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- i  F' m% m4 Q  G6 p) O# q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ D! G. x7 o/ K  w# a  C
  48. #else* i9 i4 o0 N* M% _  g4 e
  49. #define DMA_PRINTK( x... )
    9 V1 r5 B; `  u* s# P6 D/ K9 l
  50. #define DMA_FN_IN/ O' P. V6 b6 p9 v3 R! L+ ~
  51. #define DMA_FN_OUT
    0 L! j) W7 X+ V* J
  52. #endif
    * L6 K6 t$ n2 N0 a; u
  53. 6 Q% V: U0 y5 }, j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ b+ n* w' T# e8 m
  55. #define STATIC_SHIFT                3
    ) Q, P8 n- x0 k4 g6 V9 T
  56. #define TCINTEN_SHIFT               20- S! P5 O) N* b/ s$ @- v7 I
  57. #define ITCINTEN_SHIFT              21
    2 o/ G% j4 U) A# e+ q
  58. #define TCCHEN_SHIFT                22
    ) a% L1 n" I3 A6 T/ w& q5 n
  59. #define ITCCHEN_SHIFT               23' `* y3 G* l9 u6 j7 O+ h

  60. 2 S1 {2 A1 F5 `% \, R0 `: y
  61. static volatile int irqraised1 = 0;
    * s& q* R: G, a" W3 U
  62. static volatile int irqraised2 = 0;2 h# g+ f9 v* D2 X) I% d
  63. ; e  R- T9 H$ A6 z2 V( v7 J# i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 l8 T; Q" e- g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 J; S6 |! ^2 t: V& j, o* M2 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Q# @6 h( b( }  m1 R

  67. % y6 }" W$ u* J. U2 k
  68. dma_addr_t dmaphyssrc1 = 0;
    & Q* _9 H! T6 G( V' R
  69. dma_addr_t dmaphyssrc2 = 0;
    6 z, n# G. W7 G: R
  70. dma_addr_t dmaphysdest1 = 0;
    % P! n) {3 @/ X+ G+ R' {
  71. dma_addr_t dmaphysdest2 = 0;
    ! J. Q  v( u( }1 Y$ q
  72. ; }; V; `0 A/ N9 f2 G9 k( ^
  73. char *dmabufsrc1 = NULL;. y; b3 N6 j& G9 I: n! O! r
  74. char *dmabufsrc2 = NULL;( n9 M4 y( n/ z9 u
  75. char *dmabufdest1 = NULL;
    # }" x8 n+ R6 r$ P& K$ n
  76. char *dmabufdest2 = NULL;
    - ^4 W) h8 E$ A( L: f
  77. ( w9 }+ g( ^* w- H8 g! s
  78. static int acnt = 512;# }7 c" w8 P& A6 ^5 C& v9 O
  79. static int bcnt = 8;: Q+ y5 k0 O) t" V4 k4 @
  80. static int ccnt = 8;
    , J" _3 c' S& W

  81. ( z, t' _- ]2 k, l% o" C4 l
  82. module_param(acnt, int, S_IRUGO);4 m# o7 W6 I* g( s+ W$ f3 j5 P# z0 O
  83. module_param(bcnt, int, S_IRUGO);# D8 v1 j8 }+ y+ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 w% c' m2 Y$ W" n1 n. y6 Z6 A6 U0 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  ~$ s7 Y2 k7 Y- N+ k- a5 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 P3 T7 p9 A2 K4 ^' u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 L0 |( ]$ g  |2 P8 B" Z. Z
) A- q+ P) [' |' K6 v% j( r/ f! h/ ^

6 Q# [3 c  G1 b: i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 18:17 , Processed in 0.042137 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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