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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Y/ f( r- x; X* g. c( w
  1. [code]EDMA sample test application6 b9 z: X: r; G% J1 c
  2. /*
    # ^8 N" b, r, @& ~
  3. * edma_test.c# {/ T. b- F% L* t9 B8 m# X" \
  4. *
    * T; N- m% u( D5 I/ Y6 {: w
  5. * brief  EDMA3 Test Application4 [: c* A. _6 |3 U
  6. *
    9 a* _2 W) f, a1 K3 l: M" H* C0 i  G+ W1 \
  7. *   This file contains EDMA3 Test code.
    4 k+ h1 `) S  J
  8. *1 }7 |, @: `/ I) s$ ~7 Z- x$ d% m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; L" q# D* ~) S5 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( n$ h% @* C: J) g
  11. *         TO CHANGE.
    : P8 {" s6 y7 V0 K3 D( R0 E
  12. *& p# a1 U5 \1 g4 a  l7 l" H/ x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; e5 z! ^/ f9 m, f' |4 j
  14. *; h, R$ s* {) F
  15. * This program is free software; you can redistribute it and/or
    ( w% v4 s( [0 s2 H
  16. * modify it under the terms of the GNU General Public License as+ |/ k) W1 w, r& O+ v; y# m  J& t
  17. * published by the Free Software Foundation version 2.
    6 z' }3 R  i) @- C
  18. *( F" _) b8 X2 t; W$ q$ k; T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / c* O/ a2 F) V
  20. * kind, whether express or implied; without even the implied warranty" ?. s- Z8 j0 R: I+ X& f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 N' [& H0 ?# ]3 Y
  22. * GNU General Public License for more details.
    " o  h5 L* ?$ T2 f
  23. */" @- B: e( M6 E5 o" z9 I+ Y. Z. Q# k

  24. 8 {0 Y7 {. n/ ^0 X
  25. #include <linux/module.h>' R% G$ Y) B  x. I: g
  26. #include <linux/init.h>9 B; N9 t2 H6 Y
  27. #include <linux/errno.h>
    7 |) z) G# l7 T( B" K5 L6 q$ [
  28. #include <linux/types.h>
    % w4 _- Y8 C7 G0 q7 ?
  29. #include <linux/interrupt.h>
    & K1 Q# T' F% M' j) m  x! q: `
  30. #include <asm/io.h>0 @# ]  J( F( Y: F/ b6 j) D) `
  31. #include <linux/moduleparam.h>
    ) U" x1 ?+ g: U! k# ?& q
  32. #include <linux/sysctl.h>9 B7 ]! n" G' B3 |8 B
  33. #include <linux/mm.h>* Q) ]0 q' j7 q& X; I) `
  34. #include <linux/dma-mapping.h>
    3 j- V/ M! R2 {$ k% c3 \
  35. * `7 y# T7 h* w+ x
  36. #include <mach/memory.h>
    " `. Y7 Y1 Q1 T+ d
  37. #include <mach/hardware.h>; Z$ H8 C0 Z) U
  38. #include <mach/irqs.h>+ B3 m$ G" n& J
  39. #include <asm/hardware/edma.h>
    - K, s5 v4 S8 I9 C( a7 D

  40. " j( S/ @, r% q6 v6 K2 D# J& G2 B
  41. #undef EDMA3_DEBUG$ K3 A$ B5 I' S( q
  42. /*#define EDMA3_DEBUG*/& J) X" t0 U& w; S
  43. $ j: R5 y$ [* j
  44. #ifdef EDMA3_DEBUG0 v& B$ w0 x9 z+ a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 _" m8 ~4 F0 I2 V) c( V- g- e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 i; V- V4 ]3 c  L7 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- \4 K  v# Y6 @) j$ ^8 ?
  48. #else3 v# x8 \$ ~, o( v9 T( w5 G
  49. #define DMA_PRINTK( x... )
      E8 g+ e0 M- ]
  50. #define DMA_FN_IN
    " ^/ u( F1 i. e4 T, x7 M* R
  51. #define DMA_FN_OUT- N$ m" |9 i* V( `4 F
  52. #endif, o9 k) |' ]0 f" \3 _3 A

  53. & _+ K( _6 R: ]  V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " e9 W$ `) d0 R3 j7 p, Q
  55. #define STATIC_SHIFT                33 J' }: a  L$ X( d' Q; O! Q& i; i( H
  56. #define TCINTEN_SHIFT               209 V! o0 i# W" R* B) k7 u# g
  57. #define ITCINTEN_SHIFT              21
    9 ]) w% N) v9 M6 w
  58. #define TCCHEN_SHIFT                22/ T& X' u6 R0 a0 v! i
  59. #define ITCCHEN_SHIFT               23
    % \8 F. g0 w1 f  J, f
  60. 0 D8 n! G/ {$ s; C1 v
  61. static volatile int irqraised1 = 0;
    0 e9 `" Z$ H1 ^" O. E
  62. static volatile int irqraised2 = 0;8 h# V4 [- Y% d+ Q% t  u2 f5 `

  63. : F( d& C  f2 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . c/ I; @1 q& i8 S; e, \6 m  s& S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 U1 t6 s8 z* J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Y4 }4 b% B! P3 U

  67. ' @& U# f1 [* L8 F8 @; d
  68. dma_addr_t dmaphyssrc1 = 0;
    ' o) E2 @5 @' R% T# d: R
  69. dma_addr_t dmaphyssrc2 = 0;
    7 q5 B% D' `3 X7 i% J$ L. Z
  70. dma_addr_t dmaphysdest1 = 0;0 t: i) N2 ~$ K8 ?! u" s
  71. dma_addr_t dmaphysdest2 = 0;
    ' @9 M) n! A2 O3 _- t- a

  72. , Y4 v, A$ {$ o3 Q$ m
  73. char *dmabufsrc1 = NULL;" `3 S: t0 L( Q5 r8 |
  74. char *dmabufsrc2 = NULL;* b5 l) a* m7 L; Q+ H/ I: x
  75. char *dmabufdest1 = NULL;
    5 T$ t0 q% R  X& I+ W/ X
  76. char *dmabufdest2 = NULL;! f( M2 S, J) M: ^

  77. 2 o2 o# o( g- H# S( a2 W" P: p* T+ \2 t
  78. static int acnt = 512;+ d8 m; _2 q8 e4 t% ^$ V1 Q
  79. static int bcnt = 8;  S: f; q5 L2 M  M; R
  80. static int ccnt = 8;
    2 }' T% x7 v. M8 k( ~; X
  81. , t" u- j* r) o2 f! n
  82. module_param(acnt, int, S_IRUGO);
      w% P  d/ C, @# Q* [7 l3 c( J
  83. module_param(bcnt, int, S_IRUGO);
    / U) X* u  w0 o" u1 A; w1 X( z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 v- g3 `9 i' s% r5 ~
/ y) [- y3 E- Y* @8 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  ^: ^) ~3 z5 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- e. A% t9 Q  l/ W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# d( N, R2 J( v
5 i3 H, o' Q: Z" p) w4 D2 m
* s! s9 ], u/ }8 D: M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 06:54 , Processed in 0.038351 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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