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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 M# J& z5 V  V7 y& A
  1. [code]EDMA sample test application
    8 e+ n2 G8 F8 k7 L
  2. /*
    0 e1 P9 P- D: L. Q
  3. * edma_test.c
    ; U/ J3 v% f9 n  i3 `$ J
  4. */ i( F" S. T" k, ~2 b7 S: A) S. l2 r
  5. * brief  EDMA3 Test Application
    ! N0 d. C( c+ c
  6. *7 O: c6 F: \1 R* {) i* y1 K
  7. *   This file contains EDMA3 Test code.
    & @6 O. v- U3 `1 [3 k
  8. *
    . I1 L* b, }% t: _8 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & w9 }5 b) V& _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , e8 o+ ?+ j1 T2 ?
  11. *         TO CHANGE.5 }: e. U. B" H8 i
  12. *
    6 j& ?. {. V& X4 L6 f0 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % g& i' j+ y, A! g! m) w  W& ?) B
  14. *
    4 T1 n4 B2 U2 b+ n# |/ Q/ I7 V. I
  15. * This program is free software; you can redistribute it and/or
    2 v* f: r+ Y3 l- n- H
  16. * modify it under the terms of the GNU General Public License as
    - g* L, m4 G/ K
  17. * published by the Free Software Foundation version 2.* m) T+ X6 n/ N* I  O5 L
  18. *8 r, N! v/ @' m7 u: {! D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  R0 A0 i! _. e
  20. * kind, whether express or implied; without even the implied warranty6 D- y) m1 p& h# l4 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * p0 N0 d6 u. [( F& ^
  22. * GNU General Public License for more details.8 i& o8 W. f7 N& C" Y1 Y8 o1 s& z$ V
  23. */
    $ y5 M; E, i7 [# h! B( z% G
  24. ( q* u+ `, |1 l8 h) m: @1 x: u
  25. #include <linux/module.h>
    9 k# D9 ~' J2 e
  26. #include <linux/init.h>" c5 p! I% }, F! W) i
  27. #include <linux/errno.h>  |$ Z; A$ R' i
  28. #include <linux/types.h>
    8 @/ w; \8 u* w- n
  29. #include <linux/interrupt.h>
    ; @( m) N  g- T  D2 n* u+ L
  30. #include <asm/io.h>
    3 m/ s1 Q3 D. v! Z' Z- _
  31. #include <linux/moduleparam.h>
    " l3 H' K9 m+ [: F, i  {
  32. #include <linux/sysctl.h>
    + v+ ?7 i1 F, ~  p
  33. #include <linux/mm.h>+ W% w4 F. a& k6 z  j: X
  34. #include <linux/dma-mapping.h>
    : _% o0 k4 z- P- d

  35. 1 i, c0 Z+ ^* c
  36. #include <mach/memory.h>
    2 _, S$ `1 @) n( D9 o+ B, e
  37. #include <mach/hardware.h>
    , p( K7 P% C2 {1 ~$ R
  38. #include <mach/irqs.h>
    ( ^/ ]: v' U0 A% o2 E5 X
  39. #include <asm/hardware/edma.h>; ~9 ~# c3 S- B, O
  40. 3 n  z; E9 G! y" J. F0 U4 t, `9 o
  41. #undef EDMA3_DEBUG$ v( c0 h% N$ y+ J& p$ ^& `+ \
  42. /*#define EDMA3_DEBUG*/
    4 H: a( W! m( l
  43. / J! P# D8 [* Z/ `- F5 F/ b- S
  44. #ifdef EDMA3_DEBUG8 Q3 l$ Z, C5 B7 g3 F! R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & g* p) i" {) M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ r+ i- i/ ?/ `: b& J8 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / K$ n+ T* u5 R4 F* i
  48. #else  j$ f% g& Y0 D6 I7 ?
  49. #define DMA_PRINTK( x... )
    8 N- G9 I/ X; M, r  Y
  50. #define DMA_FN_IN  \# F% I2 ~4 V4 {* n5 @
  51. #define DMA_FN_OUT
    5 W8 N' l3 @% z$ q
  52. #endif
    6 l. O# G$ N- E2 Z$ B1 ?
  53. 1 y  `, x4 E. j! D  o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " G4 g% b6 V+ D
  55. #define STATIC_SHIFT                3* Z! v" [3 r9 v4 r) i
  56. #define TCINTEN_SHIFT               206 A/ e. _4 U# r' ^
  57. #define ITCINTEN_SHIFT              21
    6 _; C! e& ?8 }  f$ Z8 m. R
  58. #define TCCHEN_SHIFT                22
    2 H* L( I! B1 c* S& a: x
  59. #define ITCCHEN_SHIFT               23
    : O; o$ M0 A: L- ?5 B, H

  60. ; ?0 S3 G( E( J
  61. static volatile int irqraised1 = 0;9 u; }% Z* b7 \0 h6 g4 Z
  62. static volatile int irqraised2 = 0;
    1 b6 X' u( v# @: \: F
  63. ! T! }/ x8 R$ j7 J/ U7 }! f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K4 S- I4 a4 a* u( Z& E' @6 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o8 d% m6 |; ]" K7 Y  E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 G* p. q5 w* j2 }% P3 h. r& P; L: {

  67. 9 X; u& v# D- B! h" v( t( R1 p
  68. dma_addr_t dmaphyssrc1 = 0;
    2 z* |; {: R( c
  69. dma_addr_t dmaphyssrc2 = 0;* @( E) P4 e( d. w6 K  [
  70. dma_addr_t dmaphysdest1 = 0;
    1 T6 A- Z& |* o' I, b
  71. dma_addr_t dmaphysdest2 = 0;
      a* w, u( }) w" T: y  p

  72. 0 S5 m" \* g- f3 s: _1 h
  73. char *dmabufsrc1 = NULL;) U& m7 U4 m; b( B* q
  74. char *dmabufsrc2 = NULL;! G* Z$ z4 o- R
  75. char *dmabufdest1 = NULL;
    . D/ t- w  n7 P# o1 t
  76. char *dmabufdest2 = NULL;1 ^; S, d% o. H, G9 t
  77. " d0 H* Z7 d* n2 `9 T1 g/ }0 T
  78. static int acnt = 512;* F! ^/ r) [0 ?% I/ f! |$ X
  79. static int bcnt = 8;1 p% w* D6 O) v, `$ B$ C
  80. static int ccnt = 8;
    . M1 ~+ z. @3 e& y$ I9 [+ B
  81. ' Z4 B: B# U1 ?1 \) V- E
  82. module_param(acnt, int, S_IRUGO);. [( z. f2 ~$ p' F7 D( G
  83. module_param(bcnt, int, S_IRUGO);7 h. R2 ^/ R7 H" J2 {3 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& \6 k+ Q# h3 h5 K% c, K
7 D% M( a) ~# k( x, c5 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  D& ~' X  P1 Q, L% ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- s- ?' o1 M! f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" A* @; Q* }7 B% `% i% v4 {+ A6 m  P+ I3 v4 Q$ }) K) [
+ Y5 ?/ U0 k, e% G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 16:53 , Processed in 0.039292 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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