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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  P/ n; v2 {2 \/ ^
  1. [code]EDMA sample test application+ [2 r4 P% w6 _4 n& g; V* i& k
  2. /*2 @  Z( ]# m& e( Y! x
  3. * edma_test.c  w0 i" n# f4 R* Z) ]
  4. *% U. y9 h3 H8 z: D
  5. * brief  EDMA3 Test Application4 ?8 E! q/ H  f+ E7 r+ M
  6. *! z& \1 C6 u( a2 L( z2 ]
  7. *   This file contains EDMA3 Test code.
    4 |( d7 N6 h; s2 y+ I
  8. *4 S+ p/ }6 `8 ]* M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" x, O7 C: ^0 }! _2 ]' C, I' i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# t$ _. {; k( t
  11. *         TO CHANGE.( x9 g! q, F6 D' U& I
  12. *5 c' S* Z0 S( {8 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : m% ]0 \5 [& I( a6 I. o( t; H
  14. *5 H' E& Z& e9 K! _7 H9 F
  15. * This program is free software; you can redistribute it and/or; h) v, Q+ E: T6 A
  16. * modify it under the terms of the GNU General Public License as
    6 o0 E: T1 v7 d' z1 E1 K9 @. D% H% L
  17. * published by the Free Software Foundation version 2.+ Q- F( Z6 L5 F" m
  18. *2 B! A$ l5 D3 A1 B2 U3 |9 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 ~, ?8 M0 Y5 T$ n
  20. * kind, whether express or implied; without even the implied warranty
      V' z1 D/ G; ^8 t$ U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 _& q6 G* e5 j3 U
  22. * GNU General Public License for more details.* e2 V: q+ D6 v2 D" z" e
  23. */) _+ i$ M0 s7 b* a) Q( O3 D: r4 ]4 B
  24. 4 ]( Q% z1 _. t  s( l9 G1 C/ I2 E
  25. #include <linux/module.h>
    6 M; H0 s& c9 ~* E; |0 |5 b# Q% U
  26. #include <linux/init.h>
    & [; Z8 D% P# s2 L- Y
  27. #include <linux/errno.h>) G1 w& \: n8 T4 s9 D9 [; d
  28. #include <linux/types.h>3 y: ?  [+ s/ {/ J" W
  29. #include <linux/interrupt.h>9 y# j) ]2 D) \: x3 \
  30. #include <asm/io.h>
    - t+ e) d7 V2 ?  `& u* h0 t
  31. #include <linux/moduleparam.h>, j$ `* M4 b* r$ `; w! F0 R
  32. #include <linux/sysctl.h>
    1 Y9 H9 J9 c6 V
  33. #include <linux/mm.h>
    $ V0 x4 V2 D, @  s8 {
  34. #include <linux/dma-mapping.h>
    8 ^# o+ s6 g( R7 W  K  i

  35. $ |, {4 U" Q% S+ {% i
  36. #include <mach/memory.h>
    . u' O6 q5 i8 Q3 o* H( r8 d4 f) o
  37. #include <mach/hardware.h>0 M# k- U* ?  |/ v# R) ~9 p
  38. #include <mach/irqs.h>. g! x& ]" ~  Q% J
  39. #include <asm/hardware/edma.h>
      S' |% Y# K4 }5 t

  40. $ N9 K9 r# w- w* c
  41. #undef EDMA3_DEBUG
    1 R3 p! l! u7 A% t+ F, v
  42. /*#define EDMA3_DEBUG*/
    2 S! B8 a; ]  Y
  43. + @+ d1 D, @1 \; u8 c
  44. #ifdef EDMA3_DEBUG# T; R9 h/ p. k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 W$ L) f8 B9 s7 ^, r7 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) @. K0 _# t5 ~$ s7 L3 i5 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / A3 X/ i. r% a& _' y1 i
  48. #else' T8 G. U8 Z) V, f( s
  49. #define DMA_PRINTK( x... )$ I! w6 p+ f. s
  50. #define DMA_FN_IN3 _$ s( @- ?* G+ @" @
  51. #define DMA_FN_OUT
    * D  ^8 J8 `$ i- e( Q4 F/ r
  52. #endif% M( z: ?- h2 h: c2 h* c5 a' R

  53. ! W* D3 `" i4 F) @, ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . y- K; w, J+ o* V5 C6 M. `" W0 X- x
  55. #define STATIC_SHIFT                38 Z& l8 |; ~! E2 m( O8 r3 d
  56. #define TCINTEN_SHIFT               20
    $ r1 ]( L9 i0 {
  57. #define ITCINTEN_SHIFT              21
    $ j3 |) A  d9 Q$ g6 y
  58. #define TCCHEN_SHIFT                226 o" x2 t7 n  B" M+ I- @
  59. #define ITCCHEN_SHIFT               23  O0 o3 g# I$ E, ?" J$ l/ M
  60. ' v1 |' y- c& {) n! Z0 y( T1 h% U
  61. static volatile int irqraised1 = 0;
    * g% c" Z4 {) f4 |) m7 n- }
  62. static volatile int irqraised2 = 0;, ^% S5 [$ T- F& @) U7 G
  63. 1 W/ W( M$ }; m; E) F3 d, h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 b+ n. q0 n& @9 q6 n' ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C) l9 G4 H# v  c& O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! J  n( L( n; s" J2 y" j

  67. % ]# e. E& i* X
  68. dma_addr_t dmaphyssrc1 = 0;% O4 r4 V2 @# b- @$ P( H* l
  69. dma_addr_t dmaphyssrc2 = 0;
    1 h1 _; b. D) F; w" T
  70. dma_addr_t dmaphysdest1 = 0;/ f" O$ g% O- r
  71. dma_addr_t dmaphysdest2 = 0;
    , q; h% z" f4 e) J, `: N  i& F
  72. : n  A* f: @( o: V. i, ~6 t
  73. char *dmabufsrc1 = NULL;
    9 t' n/ U+ Q1 i* M
  74. char *dmabufsrc2 = NULL;! A" a3 o9 e  [
  75. char *dmabufdest1 = NULL;& Z" Y* [( C& P- D9 h: [
  76. char *dmabufdest2 = NULL;
    ; w) }$ d3 v) x6 V+ {4 [

  77. . |: E1 Y- ?; `0 z. h) i% e
  78. static int acnt = 512;) o2 c: Z. g# t+ l" ^8 `6 T" j
  79. static int bcnt = 8;1 E9 O+ K5 m) o. S  }. V. m# _3 Q5 S
  80. static int ccnt = 8;
    " D+ @* z$ f+ p* U$ O: k- `2 `

  81. : o8 U" R' r0 E  Y' L& ]1 b8 G
  82. module_param(acnt, int, S_IRUGO);( _4 ~  Y8 p$ y8 f
  83. module_param(bcnt, int, S_IRUGO);
    8 ~  A* l% A: L5 C% y, \/ n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 {& L! c, z* _  F$ W& r3 e; o% t* _9 @6 `0 }: y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( j4 D0 l$ O7 [$ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 h+ K" y6 L% _' R/ c3 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. Q% P' o$ L; W$ `6 V  _0 U- b8 V1 a& j
# t, j9 M! N" ^# O6 a9 n& k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 09:43 , Processed in 0.041552 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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