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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * F( m! t8 @& T1 a2 I" ~! n: G, A# S
  1. [code]EDMA sample test application- L. y8 R' j' _* E' v, I
  2. /*% `; @* @% F) n' J5 A$ g
  3. * edma_test.c
    & Y! [- n. ^) l: f; S( [
  4. */ ~' w: D8 z# c5 h# |! m9 k
  5. * brief  EDMA3 Test Application+ k3 M8 f3 b& P, B# G( K
  6. *
    & U" v3 D0 o& p$ E+ K1 K7 P8 N5 A
  7. *   This file contains EDMA3 Test code.6 A' @2 C, y: n; ~8 L$ t, J0 h
  8. *
    - t8 x/ u& V) T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ j; V8 m& b( t% z/ ~! \' M( J* F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ e7 z$ l- t; C4 K2 l8 ?
  11. *         TO CHANGE.; f$ n4 P  {' v4 t( c. M
  12. *
    % O: E  R  @* I0 Y4 q- x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / J1 R  ^! f. D/ Y4 ?$ \
  14. *( f- l3 J9 g! n1 e& b# d
  15. * This program is free software; you can redistribute it and/or
    4 o7 e, W$ z; l" \3 v
  16. * modify it under the terms of the GNU General Public License as  p/ F- t/ o# c2 o/ c& ~; I, X
  17. * published by the Free Software Foundation version 2.
    " X2 d$ v1 \& C7 \
  18. *% t5 C% a0 J5 X5 b9 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 L$ Q- I, s( V' `
  20. * kind, whether express or implied; without even the implied warranty8 R, M  G1 o- G4 g* T9 x  t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 m8 f$ L7 ^8 h( g
  22. * GNU General Public License for more details.- i0 [$ E+ S; d9 h
  23. */: O' T% E$ E. Y

  24. ! Y; V' a% S" P  D* |
  25. #include <linux/module.h>" T" Q- U: `( f) M( V: i  r" {/ C
  26. #include <linux/init.h>, B% G, Y! r  R% T) z
  27. #include <linux/errno.h>. q" `# k0 T" A' ~4 k- c# P! n
  28. #include <linux/types.h>0 F: k/ B0 i0 N; }0 e: \% y& _
  29. #include <linux/interrupt.h>" U  P" s. F2 S: S* I- b
  30. #include <asm/io.h>
    & [% N* [% v" ~
  31. #include <linux/moduleparam.h>+ X, S5 Z  f9 e8 Z! [+ U7 G
  32. #include <linux/sysctl.h>- e. ]9 i* h/ I: Y1 N
  33. #include <linux/mm.h>
    : k' I3 O' }" Z4 B4 Z# L7 S& q
  34. #include <linux/dma-mapping.h>
      {% A% I, q3 e- B/ R

  35. ) e* R  b5 C5 ]7 M! }! y
  36. #include <mach/memory.h>7 R0 U5 H" l0 a6 g
  37. #include <mach/hardware.h>; S3 x$ F+ |0 H: _
  38. #include <mach/irqs.h>& X; Z6 _3 W/ l; d. |9 s8 K
  39. #include <asm/hardware/edma.h>! o' K8 r+ ^$ |: `+ V- k; K4 x, I
  40. 5 ~* B' p# j2 n' d" N
  41. #undef EDMA3_DEBUG. S4 K" i# u, p! m" m& }3 i$ |) I4 W5 C
  42. /*#define EDMA3_DEBUG*/
    $ @" v/ x8 c2 j5 V

  43. 9 j# [" W( R3 P5 {
  44. #ifdef EDMA3_DEBUG
    : X) s  S( N1 V6 z0 K7 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); e- G0 [  I. I5 A8 @1 A$ W. J4 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 s+ q: ]4 M* C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; Y3 m- \+ |  R1 U8 g) s
  48. #else
    4 z* l2 ~. p% D0 w
  49. #define DMA_PRINTK( x... )
    ' e% x- X! W' u: q# V  y
  50. #define DMA_FN_IN! w5 b' [' d( f, Z8 R1 U
  51. #define DMA_FN_OUT' d" d+ z3 a4 a; d6 A) z% K
  52. #endif2 ^+ g2 E' g* V
  53. " s8 }8 `9 F' J' k, y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      q( h0 E0 x, x$ q8 z# w- n, u
  55. #define STATIC_SHIFT                3) t) c8 @* G. _" g
  56. #define TCINTEN_SHIFT               20
    9 ~  ]1 G- C0 L
  57. #define ITCINTEN_SHIFT              21. V7 w. O8 e3 g6 [) i6 r4 O7 D4 {' _
  58. #define TCCHEN_SHIFT                221 u1 L" h% B  r8 w6 q5 J0 G8 Y
  59. #define ITCCHEN_SHIFT               23, y$ \9 \4 I7 K7 o9 v* d8 g2 \
  60. ! l" G  U: c  O* k  t4 ?* J
  61. static volatile int irqraised1 = 0;
    ( P+ |6 _. [- Z& H$ y2 }; I
  62. static volatile int irqraised2 = 0;7 ?% M9 v3 N! `/ S1 l- y
  63. % z6 @( y* r3 n- U7 ?! J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' d) f' _8 R4 J! i0 d. e$ p8 l% d3 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . g7 n: v* {0 s9 R1 ~6 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 l/ {* v- }! U. r$ n9 F7 {
  67. % O- f+ m! R2 e) U. P/ a. T+ ]
  68. dma_addr_t dmaphyssrc1 = 0;2 Y6 y, C& a9 n) A- ~
  69. dma_addr_t dmaphyssrc2 = 0;: Q. p- e  }% X/ i# @
  70. dma_addr_t dmaphysdest1 = 0;. j9 o! V& z/ M/ l# i+ ?+ k+ \" |7 L8 r
  71. dma_addr_t dmaphysdest2 = 0;# X$ ^2 p8 `  L, o7 R; @

  72. . l3 w& j4 F8 q7 _/ i* w
  73. char *dmabufsrc1 = NULL;! T( [! j  u/ k( ?. Q
  74. char *dmabufsrc2 = NULL;
    3 m: k- k1 t1 _& Z* Q2 n
  75. char *dmabufdest1 = NULL;
    1 ?: |0 @4 }) K2 L4 |
  76. char *dmabufdest2 = NULL;9 N& d- c+ g' g# B2 @1 G
  77. 8 V7 h7 z2 e0 z; Y# g
  78. static int acnt = 512;& w5 r9 q! E" r8 x, j) q2 Y' E
  79. static int bcnt = 8;
    : B& M2 I5 \2 f( I7 O( Y
  80. static int ccnt = 8;
    5 g# {: `4 }" A

  81. 8 R5 x# g! Q2 h% n1 Y
  82. module_param(acnt, int, S_IRUGO);1 @1 [& `! ^. O& u
  83. module_param(bcnt, int, S_IRUGO);
    1 G- `! j7 M8 [5 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ q  j% O* j7 |, M

2 F$ X* L. r. `' F$ V4 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; b6 I/ N2 A0 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! C9 w) g/ H% p5 W3 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 H+ N9 l: ?, c) ]  l5 x2 B/ n- y( R. K

: W2 {  {; L; A9 T+ k, D2 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 15:57 , Processed in 0.039740 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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