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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" o  O" ^, K6 i) W& q2 w, }
  1. [code]EDMA sample test application
    & _* |7 ]: \) R# }
  2. /*5 e' i8 Y8 K! g
  3. * edma_test.c
    ' U0 \. o4 }3 |3 R: y% x/ O. l& q: W
  4. *
    + h. J; c& \6 S- x5 [$ u# n
  5. * brief  EDMA3 Test Application5 r# ]6 p. m" `; X/ \
  6. *2 i8 j, ^3 E  ?) M% I
  7. *   This file contains EDMA3 Test code.' o  b9 r: s! K! P  G$ }
  8. *
    ' d+ n5 Z0 X1 y5 C- o4 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 s) R* f: S- H* u' @+ e& ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * x- k( ?- A/ e. b" F0 r
  11. *         TO CHANGE.
    1 q/ K- j; ~: c! G8 V# k
  12. *
    ) f9 H5 m. T0 c: a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) J8 g. G( M6 B! V, g
  14. *( a$ v1 S+ }) |1 ^
  15. * This program is free software; you can redistribute it and/or
    5 W% G( |4 Q) _6 C$ c( J- D' o( x4 J
  16. * modify it under the terms of the GNU General Public License as
    6 Z. [% A/ K4 p- j2 {! k2 H
  17. * published by the Free Software Foundation version 2.
    ( c! ]' {# S( ?! A/ y
  18. *
    ; v8 h+ L- V7 R' C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 S8 D) ]/ ~, q* x
  20. * kind, whether express or implied; without even the implied warranty& x2 d8 m  [4 c0 v7 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : v! o+ w" y# x; `% q( v
  22. * GNU General Public License for more details.
    / Y% K1 {8 B* S
  23. */( X4 G. h, ]: |; I; ~( y
  24. ! f* s. T/ G' ~# @2 `! g- R- \
  25. #include <linux/module.h>$ X4 _9 m' |  ^
  26. #include <linux/init.h>6 m2 G2 ]4 K% m# O$ V" M3 N
  27. #include <linux/errno.h>; v. [) L9 R' R" @0 T- L2 T
  28. #include <linux/types.h>
    " ~1 T2 i& D- q& K# g* m/ ~! w
  29. #include <linux/interrupt.h>" a9 l0 y7 b: e& I2 s1 x4 Z5 F
  30. #include <asm/io.h>
    / f/ \3 g" R+ q1 N/ Y
  31. #include <linux/moduleparam.h>: p& [8 b. a% ~0 o" I. y7 C2 X
  32. #include <linux/sysctl.h>
    " H7 _, G+ ~; K
  33. #include <linux/mm.h>
    % ]1 P' }5 J5 h% Y* X
  34. #include <linux/dma-mapping.h>
    ' a7 U0 b4 I% U" M4 t

  35.   Y, z* O: Z) J
  36. #include <mach/memory.h>2 R5 _0 H7 y, n0 C4 b# j
  37. #include <mach/hardware.h>
    ! v: ]4 c; k8 I
  38. #include <mach/irqs.h>+ }' i' e/ h. b! [
  39. #include <asm/hardware/edma.h>
    2 s7 }5 m" g" b4 i, q( Y5 d/ L
  40. 1 ]2 k. _4 U9 n8 d1 ?. W7 V
  41. #undef EDMA3_DEBUG4 I* C0 l( w9 Q/ C( P/ ~  z
  42. /*#define EDMA3_DEBUG*/! }3 ?4 f0 L3 E& ^/ d
  43. 8 |! e  J! @5 ?- k: ^. l
  44. #ifdef EDMA3_DEBUG& b7 j/ ~& ^) r8 S( J" t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 J) F' x. g- f( |( C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / O, G# K# X3 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  M% ?3 j5 j: m* \
  48. #else. x- o6 @% r0 h. Y# }8 i/ T
  49. #define DMA_PRINTK( x... )' U( `: r0 T! ?# I4 K9 `
  50. #define DMA_FN_IN
    3 ~; U- y$ `' k! @# }2 M
  51. #define DMA_FN_OUT3 ?  `6 ~+ ~9 h  d( H
  52. #endif
    ; ^0 l' M( O$ k$ F

  53. ( P1 }$ P+ C3 }: U9 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), D. e; e; j9 _* g& s# \' P; n
  55. #define STATIC_SHIFT                3
    8 p# D1 H! g1 I3 m4 A, s  E
  56. #define TCINTEN_SHIFT               201 O# z# u8 o& l3 ]1 a$ f
  57. #define ITCINTEN_SHIFT              21, f" V% x3 R! J5 Y5 z0 v
  58. #define TCCHEN_SHIFT                22
    $ ?; a4 r/ u! {; N
  59. #define ITCCHEN_SHIFT               23
    0 }) ~9 r+ l" Q
  60. 9 I) {0 U3 S* z
  61. static volatile int irqraised1 = 0;6 B4 m9 b2 n" X# |! G
  62. static volatile int irqraised2 = 0;
    , B+ l2 a# [* Y7 ^8 g

  63. 8 o$ n/ _& J/ k4 i- ~5 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # y" h5 w1 d  R. K4 Z" h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , y2 F9 P5 U7 C  B- z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . u8 f2 g2 A# V7 g/ e$ N

  67. ) {, Y" t5 C5 b( c/ N
  68. dma_addr_t dmaphyssrc1 = 0;
    1 n4 s  m) i7 \+ i4 I, ~
  69. dma_addr_t dmaphyssrc2 = 0;
    5 C7 \3 p, N+ S1 X' S7 s2 T- _
  70. dma_addr_t dmaphysdest1 = 0;
    $ N) i+ {2 s6 J/ u# i8 {# E5 `  f
  71. dma_addr_t dmaphysdest2 = 0;# @2 ^5 ?# B$ O2 T4 y

  72. ! F4 V# ]4 ~9 t* f8 F/ J
  73. char *dmabufsrc1 = NULL;
    . b8 ~% M+ A  W+ G3 d; J! l0 q
  74. char *dmabufsrc2 = NULL;7 `" O/ @' E# ?4 l- X3 d" i8 h1 @8 Z
  75. char *dmabufdest1 = NULL;
    . m& v- F  ^* f$ b+ l, s8 ^
  76. char *dmabufdest2 = NULL;- E6 c: s) F5 E' q, M4 c+ }
  77. # u' ~5 U) P% B* h4 K. h
  78. static int acnt = 512;  A, Y4 Z" a+ [/ R; M7 e
  79. static int bcnt = 8;
    8 m0 M$ a+ H% U! ?& z
  80. static int ccnt = 8;
    % a' I/ i) B& Q

  81. $ C5 C$ d3 \' D+ K5 ~
  82. module_param(acnt, int, S_IRUGO);
    0 r% r; ^8 S- u2 H* O
  83. module_param(bcnt, int, S_IRUGO);
    9 w0 P# R% [, M& ^& h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 m: H9 O& k& U( A

/ ?' [& C7 w8 [; w; k. o% K. R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* c, v4 Y# S: j) U% h4 T
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 M8 _8 t7 [8 X) N& V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! m+ r( d& W  z  a+ ^$ U1 k. H, g- a9 a- k
! P- N# g$ K. [  ]- z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 07:23 , Processed in 0.039599 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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