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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 p% ?. S2 j" G, ^
  1. [code]EDMA sample test application
    $ m% v$ V4 x$ i: p) }) v. m/ P
  2. /*
    2 y; `1 M, E# j/ w
  3. * edma_test.c/ w6 X) r6 \. M. d; k
  4. *& _5 s" {/ U4 N, ~0 P& f0 [4 q
  5. * brief  EDMA3 Test Application. e  J& M0 N( y! M1 T; \* O
  6. *
    ; ]3 p* G6 S6 O7 t: K: w, a
  7. *   This file contains EDMA3 Test code.4 E2 b0 T, l% J! n1 _7 s
  8. *# E5 _( _+ h$ [; [' I' P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      U8 k% w% j# v5 V' _5 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - L% E1 l' X' p
  11. *         TO CHANGE.
    2 _9 B9 f+ e+ U$ F5 d! B0 Y
  12. *
    4 O6 N. q) z2 j( a1 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; ]/ W* p0 R8 n4 l8 z+ J1 s% r
  14. *
    ' p# ?4 l) ]6 A$ o- J  l
  15. * This program is free software; you can redistribute it and/or
    0 j+ e9 B# F3 z6 R6 R
  16. * modify it under the terms of the GNU General Public License as
    % _4 l, d/ J% P
  17. * published by the Free Software Foundation version 2., Z( O9 d6 N0 \2 d; ^* ~# |8 g0 F
  18. */ [( \4 R+ a5 z3 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % [, i: |2 Q8 M# u8 `- r' G
  20. * kind, whether express or implied; without even the implied warranty5 @8 p1 C2 A$ A9 q4 S# h! O/ O. B* E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . O! {7 i1 O; V
  22. * GNU General Public License for more details.1 j  ?' B: |2 ?
  23. */4 t) A  E+ v2 L
  24. ( |; ^% i: y1 K7 y. I. ?0 G) V# g3 d* R
  25. #include <linux/module.h># Y+ Q/ Z" s8 ^0 z  t* K2 D
  26. #include <linux/init.h>
    * q3 M4 ~; y- c  X
  27. #include <linux/errno.h>8 O/ O- f$ k" o. y# u! G
  28. #include <linux/types.h>2 Q/ q$ [0 ~/ b, R2 X  R% n9 T# s3 }
  29. #include <linux/interrupt.h>* `6 i/ R7 y5 x+ U
  30. #include <asm/io.h>
    ' W4 B) G7 G, @4 Z9 p& |
  31. #include <linux/moduleparam.h>
    3 {/ F4 i6 B: n9 f8 F
  32. #include <linux/sysctl.h>. Y1 h. x# m- r
  33. #include <linux/mm.h>
    ! l+ c' f( _5 G( \8 X; e6 @
  34. #include <linux/dma-mapping.h>5 x" r8 I; ?0 |$ d$ \8 F: x, R/ q" G" m

  35. * ?) {/ w( x. u  w; I% \9 w7 Z
  36. #include <mach/memory.h>4 k( E( @! @' `6 F" a
  37. #include <mach/hardware.h>
    , q4 c( A9 Y4 L4 n
  38. #include <mach/irqs.h>
    1 a# l# e+ W8 p% x5 }2 ?8 R9 h  y) m
  39. #include <asm/hardware/edma.h>6 o- q7 e# Z2 @1 C$ y. R8 _

  40. 5 s9 d  \) T/ b5 k2 B4 k8 \0 n) I) l
  41. #undef EDMA3_DEBUG
    $ e( W' T0 H& Y6 v5 Z3 P1 l
  42. /*#define EDMA3_DEBUG*/
    ) k: l5 Y6 f1 z2 N! F) I

  43. ; W! P. B/ L) t! |# s( w8 S& R
  44. #ifdef EDMA3_DEBUG
    ; q- A0 F. A6 H% k. N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ b+ n  Q. u' D( v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) O3 B' x, G$ r, X, }( P9 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( b) a' L/ D  _  }
  48. #else
    % U" A, o# ]+ h/ }( B: Y& }# _7 t
  49. #define DMA_PRINTK( x... ). g5 m: F; H8 Y
  50. #define DMA_FN_IN3 |! }  q+ b5 M9 c8 c. y
  51. #define DMA_FN_OUT
    0 `+ a7 A0 \" S5 d
  52. #endif
    7 J; b" q+ p$ f" c

  53. . c$ B+ }: L4 Y; \5 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 g9 Z% U$ H2 Z  [8 m) s5 q; W# X
  55. #define STATIC_SHIFT                3
    / ?% X# r/ S( y9 L5 ]
  56. #define TCINTEN_SHIFT               20) Y) k8 B* [. p0 w- I  t& L
  57. #define ITCINTEN_SHIFT              21# T9 j" Z) ]9 R8 w  \7 z
  58. #define TCCHEN_SHIFT                22# r  r9 l" y% f
  59. #define ITCCHEN_SHIFT               23- m/ m- U7 S$ t9 e, R& a
  60. * @1 g5 e, T6 W8 `6 I+ `
  61. static volatile int irqraised1 = 0;
    , ?, E0 `+ H4 y" k! k
  62. static volatile int irqraised2 = 0;
    8 ^. |$ |) o. E! i4 T

  63. - B0 F0 k9 ]; W1 ]' o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% l) x" W8 }, O9 h" M6 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / P) ]( C) x3 J6 p/ m( L) L& S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 j) p  s, X8 y, P
  67. ) F) W; y$ F$ [: Z) }# \
  68. dma_addr_t dmaphyssrc1 = 0;
    # {4 r2 T7 c' n- N
  69. dma_addr_t dmaphyssrc2 = 0;/ z$ M  Z2 }! R4 y  U' Z7 ^# E8 h3 E
  70. dma_addr_t dmaphysdest1 = 0;
    2 E0 J4 v% I+ O' V" Q
  71. dma_addr_t dmaphysdest2 = 0;$ q* |, p( a6 m/ D# _6 s+ R
  72. 7 o. I; i  S. e1 e( }/ l
  73. char *dmabufsrc1 = NULL;
    . P' ]  e8 b& L. D- L' G
  74. char *dmabufsrc2 = NULL;
    ' m+ k2 S5 n4 \# m8 U5 c
  75. char *dmabufdest1 = NULL;
    1 K' v* c! h6 l! s3 J
  76. char *dmabufdest2 = NULL;9 A: c/ g4 p  E! Z7 E5 M( k/ ]6 y
  77. : R* `: Z& M* h# i; I+ A9 Q0 x) S" f
  78. static int acnt = 512;3 l" [5 |5 _! |9 k8 P: `
  79. static int bcnt = 8;% ^; V6 F" A: h6 @3 s8 [2 F
  80. static int ccnt = 8;
    ; t' q; a2 r" @$ H0 y+ U

  81. 3 Q8 _  e- G2 R0 ]( u1 ?5 d7 w
  82. module_param(acnt, int, S_IRUGO);5 g% T7 u; h! K* W* F) n' c/ k
  83. module_param(bcnt, int, S_IRUGO);& }/ Z6 y! ]. @5 ^4 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( u2 ^# ^  \( g& k8 `

  K' G, s% j( f8 C& V0 g- ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 o3 H' L3 [9 L% C: w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 y$ c/ Z4 G4 l: x& e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 l. e# Q/ n1 j, j, g8 J# i/ D
8 I7 [' p9 s# j' Y; e
, q2 T5 r5 o0 P7 n4 w/ u! u4 F4 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 04:52 , Processed in 0.037577 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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