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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 Z8 s- S0 f7 |# v  F/ b
  1. [code]EDMA sample test application2 Q' I8 H+ `3 c2 A* g
  2. /*9 y: R5 c' o0 f; ^( ~" w: z
  3. * edma_test.c3 d- ^$ \+ F5 \- `, a: V
  4. *
    % O4 u8 K, j) E. P5 P7 ?
  5. * brief  EDMA3 Test Application: o( M$ \( M8 w( x9 U& T! ^; _
  6. *" }/ S' q  y; c6 X$ l4 k
  7. *   This file contains EDMA3 Test code.+ L+ g1 Q- J/ Z/ h% H7 c) D+ P
  8. *. F3 _+ P3 E5 d6 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 m# `' X* F9 n. M& l" f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. F( o& t# K% i# L3 g; x
  11. *         TO CHANGE.- L4 o; Y- s9 q( _. s
  12. *( E; M5 Z4 n! Z: r+ c( M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . r6 K0 U* b9 v; d3 d. m
  14. *
    , E& T& `2 ~# Q
  15. * This program is free software; you can redistribute it and/or6 y' ]5 g+ H( M0 t2 A$ _
  16. * modify it under the terms of the GNU General Public License as
    ' T4 O7 D2 Y4 x9 ^: f. ~
  17. * published by the Free Software Foundation version 2.' D8 K3 t# }& \; X
  18. *
    . r2 K- E' t/ v; K% h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " t( o3 `2 l! {; X# ?. e
  20. * kind, whether express or implied; without even the implied warranty( p& R* L# M! e0 U: B7 A2 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& [# m4 G7 {/ l! Y+ {
  22. * GNU General Public License for more details.
    ! l2 L. F$ L; H. ~8 M
  23. */% K* E3 h7 l) M- Z4 C7 Y$ s

  24. ( E6 U2 W2 M7 ^. K' D' x" f
  25. #include <linux/module.h>( Z- H3 }) i/ R% h, j% y6 |
  26. #include <linux/init.h>
    - m( R! C/ n+ `' ]' H6 N9 V1 B0 C: s
  27. #include <linux/errno.h>% `  b4 K% g; ]  m+ _
  28. #include <linux/types.h>5 ]5 I8 d8 S5 P$ U  {
  29. #include <linux/interrupt.h>
    : I% Z- p7 ?% ]( h5 {0 l& y7 k- O$ u
  30. #include <asm/io.h>5 @/ H3 F) r% r1 z# I2 O  H0 c
  31. #include <linux/moduleparam.h>& `) a9 `1 m1 T" N/ @$ p! r! [5 G$ c
  32. #include <linux/sysctl.h>: E. H& k1 |9 E" @, z
  33. #include <linux/mm.h>' D7 d4 Q, }5 H) K. Q3 U5 q5 @
  34. #include <linux/dma-mapping.h>% V4 i" m, k6 _2 S  Y) X( V
  35. ( u/ e8 i! e/ j1 P1 y
  36. #include <mach/memory.h>/ T. s  V9 V) `' {# N) O, B
  37. #include <mach/hardware.h>
    4 v* A9 {  s- E3 _6 D
  38. #include <mach/irqs.h>
    ! n6 t3 }( m1 {
  39. #include <asm/hardware/edma.h>
    - M1 e# W  p# t$ n8 z4 o5 K6 [
  40. 4 b7 I# {2 n2 N# v' C
  41. #undef EDMA3_DEBUG1 ?0 v+ x4 W) V2 D
  42. /*#define EDMA3_DEBUG*/  J% L! N  k$ E9 y7 u
  43. " K% o, Z8 ^, V1 o7 J
  44. #ifdef EDMA3_DEBUG: ?( f  k$ l. I; _: i/ N" L* S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . d; T7 q+ J/ f* L- a2 Y' d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , ]! C7 x( ]1 w) @6 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) e" s$ ]4 p( ?4 D' Z
  48. #else( |2 }+ \  z. }
  49. #define DMA_PRINTK( x... )
    . v3 k2 O, R) c6 b
  50. #define DMA_FN_IN
    6 E6 B; h$ C2 m) ~! B6 T$ H
  51. #define DMA_FN_OUT
    ; R7 Z7 t4 c. h1 f# C2 J
  52. #endif5 p. A% L1 N# s+ c8 p5 m' Y& Q  N

  53. " X! ?5 g$ p% J, K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); V, X- d; q! L' ]5 r
  55. #define STATIC_SHIFT                3
    - `0 t# Q& Q+ L% K7 s  y! o1 ^
  56. #define TCINTEN_SHIFT               20
    ' {' J& ^7 M$ J+ S; R8 ?
  57. #define ITCINTEN_SHIFT              21
    " z  ~) ^6 C" H( g0 V- R5 ^
  58. #define TCCHEN_SHIFT                22
    ( s8 }; J$ Y; m  J, Y9 x, z
  59. #define ITCCHEN_SHIFT               23
      H& n7 p0 G) I

  60. $ {8 b# f0 x0 x5 A, U' H
  61. static volatile int irqraised1 = 0;
    0 u2 P) L5 W2 z: G0 H( M
  62. static volatile int irqraised2 = 0;. }4 p: |$ d  |9 {' V: `) C  n" c

  63. & Y) d" q; f& \$ N; I! s  d' C2 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      }, z9 e4 V4 t5 L7 R: x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 p' P2 E# n5 [( i6 E$ @& E% O3 M7 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ?0 ?/ y/ a+ Q* N
  67. / U* D/ @6 |" L' K# |' \4 B, X
  68. dma_addr_t dmaphyssrc1 = 0;6 ~8 N, \9 ]/ q! n* z
  69. dma_addr_t dmaphyssrc2 = 0;
      L$ Z# p$ y, c  K# ~
  70. dma_addr_t dmaphysdest1 = 0;- c; m' E2 H( z+ R
  71. dma_addr_t dmaphysdest2 = 0;  G2 r# ?$ _. H

  72. 6 N4 ]" e4 z& Z2 F" s& d: s
  73. char *dmabufsrc1 = NULL;5 P) e2 c/ ]4 P: U( ^2 l
  74. char *dmabufsrc2 = NULL;
    : M! M% V: {' e. |
  75. char *dmabufdest1 = NULL;
    : s: `5 O( }# u1 R) m: s. f
  76. char *dmabufdest2 = NULL;4 u& {6 Q# ?7 w5 V# L0 `# j6 A& S

  77. 6 K; W2 Z) c4 f; Q
  78. static int acnt = 512;( e! l% T! @; Z; G0 B6 w- j, [! t$ Z
  79. static int bcnt = 8;# _& Y1 a2 V# `. X& L( F; q
  80. static int ccnt = 8;
    7 {8 D" \3 R+ Z; @+ S

  81. 2 ^' z  {7 f3 R
  82. module_param(acnt, int, S_IRUGO);/ i2 ^; ]* L: ?- i9 D
  83. module_param(bcnt, int, S_IRUGO);# x8 y6 K  g! g& o$ X* \" u& V5 r# a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ `+ Y6 P; L/ o* L; I, }
7 F. C' Y1 ^) b, E1 N2 b' E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% A" {) w5 d( @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! r! J3 F' G$ u" w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: E4 K8 e2 G& F9 I+ C: L+ d2 P% U

, y! L1 Y2 i& ?, v3 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-3 05:01 , Processed in 0.037018 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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