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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : X1 K) l5 C, M! X) J
  1. [code]EDMA sample test application' J' H6 `" K' Z( K% q4 R
  2. /*
    . z' c+ ~$ Z  t$ a2 [
  3. * edma_test.c1 W6 {1 q8 C; V7 U' z% L5 P
  4. *
    ' J5 I$ L; H+ Q( T  S2 A/ _
  5. * brief  EDMA3 Test Application
    3 l; `$ I' y8 K' t  u3 ~% i
  6. *; |5 @, h% B9 M+ `
  7. *   This file contains EDMA3 Test code.- _4 g! l: U& i
  8. *
    - L' ]9 z( V4 g- ?7 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! B& A  o' ?, X' M4 F& ?0 E& J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! `; `  E8 [: ~; H+ _
  11. *         TO CHANGE.
    2 G  n; d. @9 X4 H
  12. *9 y  J* m* b5 l. N' o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 W% F. _  O9 C8 L+ R% D' O
  14. *# y  s: i. U  r
  15. * This program is free software; you can redistribute it and/or- [9 f8 M- Y9 V+ R
  16. * modify it under the terms of the GNU General Public License as: T9 R5 i+ d, H; N/ Z
  17. * published by the Free Software Foundation version 2.
    3 m& S& I% v& F1 Y. N0 e
  18. *
    1 E1 N8 o( I5 D# Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 R0 `) p9 c5 `" ^
  20. * kind, whether express or implied; without even the implied warranty0 ~9 S5 s, U" \* z8 b! `' t) N' X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( ~9 M. D  L1 @' S3 M
  22. * GNU General Public License for more details.
    ; G. C* k( G1 c, O" _- U
  23. */8 \0 J) J1 m# b
  24. 9 t3 s1 W- [& H: d& f" Y, C/ M3 _
  25. #include <linux/module.h>; q+ X* B( g7 u- p4 j& `
  26. #include <linux/init.h>2 A& L0 G+ Q# |
  27. #include <linux/errno.h>* f" M% w: o% D. `& T2 ^
  28. #include <linux/types.h>
    # Q: v8 L: g4 K; c: X& e1 d
  29. #include <linux/interrupt.h>
    2 I6 H5 Y* s' D8 r9 {- }
  30. #include <asm/io.h>
    . c; m5 s+ q3 _9 z/ A1 b
  31. #include <linux/moduleparam.h>- Z8 @% @) N9 Q8 G7 k, F
  32. #include <linux/sysctl.h>
    2 }% p/ d  U7 `5 ?: f" }
  33. #include <linux/mm.h>
    8 Y, y& Z, {- q4 H' n. y
  34. #include <linux/dma-mapping.h>) o" Q" r6 O, T9 D& H: l
  35. % e) ~" o7 s. s" O& A- x% y4 W- j
  36. #include <mach/memory.h>: ^- Y1 l6 ]8 y
  37. #include <mach/hardware.h>
    ( {( w  @0 z  w* n
  38. #include <mach/irqs.h>
    & j4 l! g+ F" G4 o2 z) {# C+ \3 a* _
  39. #include <asm/hardware/edma.h>
    7 [* y7 v$ r, P) h
  40. % E2 R. ~" e) Z
  41. #undef EDMA3_DEBUG
    / g) L3 a$ Q  O& G* I+ I
  42. /*#define EDMA3_DEBUG*/
    + i  u) C- U  {8 |' O  h! d
  43. 2 g1 d+ g% k% @. o# v$ i4 s: L
  44. #ifdef EDMA3_DEBUG) n' D9 Q' D2 ]/ x, B8 E, \" O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 P$ C4 b! W, J1 V+ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 S) F( d8 U' [# ^$ J3 a1 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) q+ N6 E$ r' g, ^! ]$ w
  48. #else
    9 ]3 B+ }2 j& `4 }  V1 D, f+ |
  49. #define DMA_PRINTK( x... )
    # [( i. a- Q* }; y/ W* L
  50. #define DMA_FN_IN( w, r- ?. g/ C$ n, t0 [2 G, c' @
  51. #define DMA_FN_OUT( A& y# N% N* T) Z1 B
  52. #endif
    % u7 ~* P! G8 _+ q

  53. & z( F3 E/ a; m) Y% U" \. t4 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % j" C5 [1 k. w, U- S+ z
  55. #define STATIC_SHIFT                3
    . }8 h  ~; p; r; ~# z: N
  56. #define TCINTEN_SHIFT               20
    3 {. K0 D1 r" h6 K8 c
  57. #define ITCINTEN_SHIFT              21
    4 ]- I- I. |! Q& v. g% p( z
  58. #define TCCHEN_SHIFT                22
    - x6 a  U; Q- p/ A
  59. #define ITCCHEN_SHIFT               23
    $ x( H( H3 R6 D3 X( D- Z: E
  60. 8 Y* z  Z. i- G
  61. static volatile int irqraised1 = 0;
    - o3 \! \; a/ ~( @
  62. static volatile int irqraised2 = 0;
    # r& x( \7 w% A2 l9 o' V

  63. ' x8 ^- g$ `5 ?7 d% N& W8 Y4 M+ `' ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b$ l% {# U2 e. [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, X3 O, {) U0 {# {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : q; T4 u  U" P/ m8 \. B

  67. : i0 d" h& f  f4 J5 b6 C
  68. dma_addr_t dmaphyssrc1 = 0;
    4 f3 o' }& {; p  P0 S  D
  69. dma_addr_t dmaphyssrc2 = 0;
    - q$ e! B+ d9 l4 H' ^9 k+ ^
  70. dma_addr_t dmaphysdest1 = 0;- I/ I, G% n3 ]0 \5 E( _* `
  71. dma_addr_t dmaphysdest2 = 0;8 d2 P" o( b) [$ W" k

  72. ! L- p" |1 x+ m/ W& t
  73. char *dmabufsrc1 = NULL;
    ' \! @6 @: B/ I6 \6 l' [" p8 F, U/ f
  74. char *dmabufsrc2 = NULL;! @* M& p8 M, x8 O5 u
  75. char *dmabufdest1 = NULL;
    0 T* ^( R$ m5 V8 k! K0 P  D
  76. char *dmabufdest2 = NULL;$ n( ?' r9 v5 O
  77. 0 d& F  H5 K9 Z2 x- e1 s
  78. static int acnt = 512;7 K5 b% V  r' X! }& Q1 A
  79. static int bcnt = 8;
    4 O* D: Q. g3 q1 Y5 ?
  80. static int ccnt = 8;
    " U, \4 {$ j* `! |

  81. ; Y- n) m& `! a- O7 S  d, C& w, n
  82. module_param(acnt, int, S_IRUGO);
    0 m$ y8 t1 S6 x+ K2 D
  83. module_param(bcnt, int, S_IRUGO);$ z' ?# P- l% ?; |, Z. j# F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- m+ D4 P4 T" E. R8 u- s
8 r* [! W1 l  f- L/ ~+ i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Z4 ?' I$ A. a. U" D% Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" X* e2 d" _/ p) L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 e& a' d/ E3 c5 |' Y; `. F( W$ B  r3 v6 a

: ^1 E, p9 f% V9 C+ D% r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-17 20:18 , Processed in 0.045472 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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